Skip to content

Commit 10518b4

Browse files
committed
meson: Add installcheck equivalent
1 parent 4b0102a commit 10518b4

File tree

15 files changed

+89
-6
lines changed

15 files changed

+89
-6
lines changed

.cirrus.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,17 @@ task:
121121
meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
122122
EOF
123123
124+
# test runningcheck
125+
test_running_script: |
126+
su postgres <<-EOF
127+
ulimit -c unlimited
128+
export LD_LIBRARY_PATH="$(pwd)/tmp_install/usr/local/lib/:$LD_LIBRARY_PATH"
129+
tmp_install/usr/local/bin/initdb
130+
tmp_install/usr/local/bin/pg_ctl -c -o '-c fsync=off' -D runningcheck -l testrun/runningcheck.log start
131+
meson test $MTEST_ARGS --num-processes ${TEST_JOBS} --setup running
132+
tmp_install/usr/local/bin/pg_ctl -D runningcheck -l testrun/runningcheck.log stop
133+
EOF
134+
124135
on_failure:
125136
<<: *on_failure_meson
126137
cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores

contrib/basic_archive/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ tests += {
2525
'regress_args': [
2626
'--temp-config', files('basic_archive.conf'),
2727
],
28+
'runningcheck': false,
2829
},
2930
}

contrib/pg_freespacemap/meson.build

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,8 @@ tests += {
3333
'regress_args': [
3434
'--temp-config', files('pg_freespacemap.conf')
3535
],
36+
# Disabled because these tests require "autovacuum=off", which
37+
# typical runningcheck users do not have (e.g. buildfarm clients).
38+
'runningcheck': false,
3639
},
3740
}

contrib/pg_stat_statements/meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,9 @@ tests += {
4141
'pg_stat_statements',
4242
],
4343
'regress_args': ['--temp-config', files('pg_stat_statements.conf')],
44+
# Disabled because these tests require
45+
# "shared_preload_libraries=pg_stat_statements", which typical
46+
# runningcheck users do not have (e.g. buildfarm clients).
47+
'runningcheck': false,
4448
},
4549
}

contrib/pg_walinspect/meson.build

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ tests += {
2828
'sql': [
2929
'pg_walinspect',
3030
],
31+
# Disabled because these tests require "wal_level=replica", which
32+
# some runningcheck users do not have (e.g. buildfarm clients).
3133
'regress_args': ['--temp-config', files('walinspect.conf')],
34+
'runningcheck': false,
3235
},
3336
}

contrib/test_decoding/meson.build

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ tests += {
4343
'regress_args': [
4444
'--temp-config', files('logical.conf'),
4545
],
46+
# Disabled because these tests require "wal_level=logical", which
47+
# typical runningcheck users do not have (e.g. buildfarm clients).
48+
'runningcheck': false,
4649
},
4750
'isolation': {
4851
'specs': [
@@ -60,6 +63,8 @@ tests += {
6063
'regress_args': [
6164
'--temp-config', files('logical.conf'),
6265
],
66+
# see above
67+
'runningcheck': false,
6368
},
6469
'tap': {
6570
'tests': [

meson.build

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2889,6 +2889,21 @@ endif
28892889
# Test Generation
28902890
###############################################################
28912891

2892+
# when using a meson version understanding exclude_suites, define a 'default'
2893+
# test setup that excludes tests running against a pre-existing install and a
2894+
# 'running' setup that conflicts with creation of the temporary installation
2895+
# and tap tests (which don't support running against a running server).
2896+
if meson.version().version_compare('>=0.57')
2897+
add_test_setup('default',
2898+
is_default: true,
2899+
exclude_suites: ['running'])
2900+
add_test_setup('running',
2901+
exclude_suites: ['temp-install', 'setup', 'tap'])
2902+
runningcheck = true
2903+
else
2904+
runningcheck = false
2905+
endif
2906+
28922907
testwrap = files('src/tools/testwrap')
28932908

28942909
foreach test_dir : tests
@@ -2917,18 +2932,27 @@ foreach test_dir : tests
29172932

29182933
test_output = test_result_dir / test_dir['name'] / kind
29192934

2935+
# unless specified by the test, choose a non-conflicting database name,
2936+
# to avoid conflicts when running against existing server.
2937+
dbname = t.get('dbname',
2938+
'regression_@0@_@1@'.format(test_dir['name'], kind))
2939+
29202940
test_command = [
29212941
runner.full_path(),
29222942
'--inputdir', t.get('inputdir', test_dir['sd']),
29232943
'--expecteddir', t.get('expecteddir', test_dir['sd']),
29242944
'--outputdir', test_output,
2925-
'--temp-instance', test_output / 'tmp_check',
29262945
'--bindir', '',
29272946
'--dlpath', test_dir['bd'],
29282947
'--max-concurrent-tests=20',
2929-
'--port', testport.to_string(),
2948+
'--dbname', dbname,
29302949
] + t.get('regress_args', [])
29312950

2951+
test_command_tmp_install = test_command + [
2952+
'--temp-instance', test_output / 'tmp_check',
2953+
'--port', testport.to_string(),
2954+
]
2955+
29322956
if t.has_key('schedule')
29332957
test_command += ['--schedule', t['schedule'],]
29342958
endif
@@ -2943,7 +2967,6 @@ foreach test_dir : tests
29432967
env.prepend('PATH', temp_install_bindir, test_dir['bd'])
29442968

29452969
test_kwargs = {
2946-
'suite': [test_dir['name']],
29472970
'priority': 10,
29482971
'timeout': 1000,
29492972
'depends': test_deps + t.get('deps', []),
@@ -2954,11 +2977,26 @@ foreach test_dir : tests
29542977
python,
29552978
args: testwrap_base + [
29562979
'--testname', kind,
2957-
'--', test_command,
2980+
'--', test_command_tmp_install,
29582981
],
2982+
suite: [test_dir['name'], 'temp-install'],
29592983
kwargs: test_kwargs,
29602984
)
29612985

2986+
# some tests can't support running against running DB
2987+
if runningcheck and t.get('runningcheck', true)
2988+
test(test_dir['name'] / kind + '-running',
2989+
python,
2990+
args: testwrap_base + [
2991+
'--testname', kind,
2992+
'--', test_command,
2993+
],
2994+
is_parallel: t.get('runningcheck-parallel', true),
2995+
suite: [test_dir['name'], 'running'],
2996+
kwargs: test_kwargs,
2997+
)
2998+
endif
2999+
29623000
testport += 1
29633001
elif kind == 'tap'
29643002
if not tap_tests_enabled
@@ -2982,7 +3020,7 @@ foreach test_dir : tests
29823020

29833021
test_kwargs = {
29843022
'protocol': 'tap',
2985-
'suite': [test_dir['name']],
3023+
'suite': [test_dir['name'], 'tap'],
29863024
'timeout': 1000,
29873025
'depends': test_deps + t.get('deps', []),
29883026
'env': env,

src/interfaces/ecpg/test/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ tests += {
8585
'test_kwargs': {
8686
'depends': ecpg_test_dependencies,
8787
},
88+
'dbname': 'ecpg1_regression,ecpg2_regression',
8889
'regress_args': ecpg_regress_args,
8990
},
9091
}

src/test/isolation/meson.build

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,8 @@ tests += {
6767
'priority': 40,
6868
'timeout': 1000,
6969
},
70+
# checks pg_locks etc
71+
'runningcheck-parallel': false,
72+
'dbname': 'isolation',
7073
},
7174
}

src/test/modules/commit_ts/meson.build

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ tests += {
66
'sql': [
77
'commit_timestamp',
88
],
9+
# Disabled because these tests require "track_commit_timestamp = on",
10+
# which typical runningcheck users do not have (e.g. buildfarm clients).
11+
'runningcheck': false,
912
},
1013
'tap': {
1114
'tests': [

0 commit comments

Comments
 (0)