@@ -2920,14 +2920,27 @@ endif
2920
2920
# Test Generation
2921
2921
###############################################################
2922
2922
2923
+ # When using a meson version understanding exclude_suites, define a
2924
+ # 'tmp_install' test setup (the default) that excludes tests running against a
2925
+ # pre-existing install and a 'running' setup that conflicts with creation of
2926
+ # the temporary installation and tap tests (which don't support running
2927
+ # against a running server).
2928
+
2929
+ running_suites = []
2930
+ install_suites = []
2931
+ if meson .version().version_compare(' >=0.57' )
2932
+ runningcheck = true
2933
+ else
2934
+ runningcheck = false
2935
+ endif
2936
+
2923
2937
testwrap = files (' src/tools/testwrap' )
2924
2938
2925
2939
foreach test_dir : tests
2926
2940
testwrap_base = [
2927
2941
testwrap,
2928
2942
' --basedir' , meson .build_root(),
2929
2943
' --srcdir' , test_dir[' sd' ],
2930
- ' --testgroup' , test_dir[' name' ],
2931
2944
]
2932
2945
2933
2946
foreach kind, v : test_dir
@@ -2940,55 +2953,94 @@ foreach test_dir : tests
2940
2953
if kind in [' regress' , ' isolation' , ' ecpg' ]
2941
2954
if kind == ' regress'
2942
2955
runner = pg_regress
2956
+ fallback_dbname = ' regression_@0@'
2943
2957
elif kind == ' isolation'
2944
2958
runner = pg_isolation_regress
2959
+ fallback_dbname = ' isolation_regression_@0@'
2945
2960
elif kind == ' ecpg'
2946
2961
runner = pg_regress_ecpg
2962
+ fallback_dbname = ' ecpg_regression_@0@'
2947
2963
endif
2948
2964
2949
- test_output = test_result_dir / test_dir[' name' ] / kind
2965
+ test_group = test_dir[' name' ]
2966
+ test_group_running = test_dir[' name' ] + ' -running'
2950
2967
2951
- test_command = [
2968
+ test_output = test_result_dir / test_group / kind
2969
+ test_output_running = test_result_dir / test_group_running/ kind
2970
+
2971
+ # Unless specified by the test, choose a non-conflicting database name,
2972
+ # to avoid conflicts when running against existing server.
2973
+ dbname = t.get(' dbname' ,
2974
+ fallback_dbname.format(test_dir[' name' ]))
2975
+
2976
+ test_command_base = [
2952
2977
runner.full_path(),
2953
2978
' --inputdir' , t.get(' inputdir' , test_dir[' sd' ]),
2954
2979
' --expecteddir' , t.get(' expecteddir' , test_dir[' sd' ]),
2955
- ' --outputdir' , test_output,
2956
- ' --temp-instance' , test_output / ' tmp_check' ,
2957
2980
' --bindir' , '' ,
2958
2981
' --dlpath' , test_dir[' bd' ],
2959
2982
' --max-concurrent-tests=20' ,
2960
- ' --port ' , testport.to_string() ,
2983
+ ' --dbname ' , dbname ,
2961
2984
] + t.get(' regress_args' , [])
2962
2985
2986
+ test_selection = []
2963
2987
if t.has_key(' schedule' )
2964
- test_command += [' --schedule' , t[' schedule' ],]
2988
+ test_selection += [' --schedule' , t[' schedule' ],]
2965
2989
endif
2966
2990
2967
2991
if kind == ' isolation'
2968
- test_command += t.get(' specs' , [])
2992
+ test_selection += t.get(' specs' , [])
2969
2993
else
2970
- test_command += t.get(' sql' , [])
2994
+ test_selection += t.get(' sql' , [])
2971
2995
endif
2972
2996
2973
2997
env = test_env
2974
2998
env.prepend(' PATH' , temp_install_bindir, test_dir[' bd' ])
2975
2999
2976
3000
test_kwargs = {
2977
- ' suite' : [test_dir[' name' ]],
2978
3001
' priority' : 10 ,
2979
3002
' timeout' : 1000 ,
2980
3003
' depends' : test_deps + t.get(' deps' , []),
2981
3004
' env' : env,
2982
3005
} + t.get(' test_kwargs' , {})
2983
3006
2984
- test (test_dir[ ' name ' ] / kind,
3007
+ test (test_group / kind,
2985
3008
python,
2986
- args : testwrap_base + [
3009
+ args : [
3010
+ testwrap_base,
3011
+ ' --testgroup' , test_group,
2987
3012
' --testname' , kind,
2988
- ' --' , test_command,
3013
+ ' --' ,
3014
+ test_command_base,
3015
+ ' --outputdir' , test_output,
3016
+ ' --temp-instance' , test_output / ' tmp_check' ,
3017
+ ' --port' , testport.to_string(),
3018
+ test_selection,
2989
3019
],
3020
+ suite : test_group,
2990
3021
kwargs : test_kwargs,
2991
3022
)
3023
+ install_suites += test_group
3024
+
3025
+ # some tests can't support running against running DB
3026
+ if runningcheck and t.get(' runningcheck' , true )
3027
+ test (test_group_running / kind,
3028
+ python,
3029
+ args : [
3030
+ testwrap_base,
3031
+ ' --testgroup' , test_group_running,
3032
+ ' --testname' , kind,
3033
+ ' --' ,
3034
+ test_command_base,
3035
+ ' --outputdir' , test_output_running,
3036
+ test_selection,
3037
+ ],
3038
+ is_parallel : t.get(' runningcheck-parallel' , true ),
3039
+ suite : test_group_running,
3040
+ kwargs : test_kwargs,
3041
+ )
3042
+ running_suites += test_group_running
3043
+ endif
2992
3044
2993
3045
testport += 1
2994
3046
elif kind == ' tap'
@@ -3011,9 +3063,10 @@ foreach test_dir : tests
3011
3063
env.set(name, value)
3012
3064
endforeach
3013
3065
3066
+ test_group = test_dir[' name' ]
3014
3067
test_kwargs = {
3015
3068
' protocol' : ' tap' ,
3016
- ' suite' : [test_dir[ ' name ' ]] ,
3069
+ ' suite' : test_group ,
3017
3070
' timeout' : 1000 ,
3018
3071
' depends' : test_deps + t.get(' deps' , []),
3019
3072
' env' : env,
@@ -3033,12 +3086,14 @@ foreach test_dir : tests
3033
3086
python,
3034
3087
kwargs : test_kwargs,
3035
3088
args : testwrap_base + [
3089
+ ' --testgroup' , test_dir[' name' ],
3036
3090
' --testname' , onetap_p,
3037
3091
' --' , test_command,
3038
3092
test_dir[' sd' ] / onetap,
3039
3093
],
3040
3094
)
3041
3095
endforeach
3096
+ install_suites += test_group
3042
3097
else
3043
3098
error (' unknown kind @0@ of test in @1@' .format(kind, test_dir[' sd' ]))
3044
3099
endif
@@ -3047,6 +3102,14 @@ foreach test_dir : tests
3047
3102
3048
3103
endforeach # directories with tests
3049
3104
3105
+ # repeat condition so meson realizes version dependency
3106
+ if meson .version().version_compare(' >=0.57' )
3107
+ add_test_setup (' tmp_install' ,
3108
+ is_default : true ,
3109
+ exclude_suites : running_suites)
3110
+ add_test_setup (' running' ,
3111
+ exclude_suites : [' setup' ] + install_suites)
3112
+ endif
3050
3113
3051
3114
3052
3115
###############################################################
0 commit comments