Hi, On Wed, 17 Jul 2024 at 00:27, Jacob Champion <jacob.champ...@enterprisedb.com> wrote: > > On Tue, Jul 16, 2024 at 2:12 PM Nazir Bilal Yavuz <byavu...@gmail.com> wrote: > > > > 2- If PG_TEST_EXTRA is set from the setup command, use it from the > > setup command and discard the environment variable. If PG_TEST_EXTRA > > is not set from the setup command, then use it from the environment. > > Is there a way for the environment to override the Meson setting > rather than vice-versa? My vote would be to have both available, but > with the implementation in patch 2 I'd still have to reconfigure if I > wanted to change my test setup.
I think something like attached does the trick. I did not test it extensively but it passed the couple of tests I tried. -- Regards, Nazir Bilal Yavuz Microsoft
From f03878870cbbac661bd6f7b483fd1dcf36d5ea38 Mon Sep 17 00:00:00 2001 From: Nazir Bilal Yavuz <byavu...@gmail.com> Date: Wed, 17 Jul 2024 00:54:29 +0300 Subject: [PATCH] Solution 3 --- meson.build | 6 +----- meson_options.txt | 2 +- src/tools/testwrap | 5 +++++ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 5387bb6d5fd..3105b3e6724 100644 --- a/meson.build +++ b/meson.build @@ -3224,11 +3224,6 @@ test_env.set('PG_REGRESS', pg_regress.full_path()) test_env.set('REGRESS_SHLIB', regress_module.full_path()) test_env.set('INITDB_TEMPLATE', test_initdb_template) -# Test suites that are not safe by default but can be run if selected -# by the user via the whitespace-separated list in variable PG_TEST_EXTRA. -# Export PG_TEST_EXTRA so it can be checked in individual tap tests. -test_env.set('PG_TEST_EXTRA', get_option('PG_TEST_EXTRA')) - # Add the temporary installation to the library search path on platforms where # that works (everything but windows, basically). On windows everything # library-like gets installed into bindir, solving that issue. @@ -3292,6 +3287,7 @@ foreach test_dir : tests testwrap, '--basedir', meson.build_root(), '--srcdir', test_dir['sd'], + '--pg_test_extra', get_option('PG_TEST_EXTRA'), ] foreach kind, v : test_dir diff --git a/meson_options.txt b/meson_options.txt index 246cecf3827..042fd22cebe 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -47,7 +47,7 @@ option('injection_points', type: 'boolean', value: false, description: 'Enable injection points') option('PG_TEST_EXTRA', type: 'string', value: '', - description: 'Enable selected extra tests') + description: 'Enable selected extra tests, please note that this can be overriden by PG_TEST_EXTRA environment variable') option('atomics', type: 'boolean', value: true, description: 'Use atomic operations') diff --git a/src/tools/testwrap b/src/tools/testwrap index 9a270beb72d..389a7f6a113 100755 --- a/src/tools/testwrap +++ b/src/tools/testwrap @@ -13,6 +13,7 @@ parser.add_argument('--basedir', help='base directory of test', type=str) parser.add_argument('--testgroup', help='test group', type=str) parser.add_argument('--testname', help='test name', type=str) parser.add_argument('--skip', help='skip test (with reason)', type=str) +parser.add_argument('--pg_test_extra', help='extra tests', type=str) parser.add_argument('test_command', nargs='*') args = parser.parse_args() @@ -41,6 +42,10 @@ env_dict = {**os.environ, 'TESTDATADIR': os.path.join(testdir, 'data'), 'TESTLOGDIR': os.path.join(testdir, 'log')} +# If PG_TEST_EXTRA is not set in the environment, then use it from meson +if "PG_TEST_EXTRA" not in os.environ: + env_dict["PG_TEST_EXTRA"] = args.pg_test_extra + sp = subprocess.Popen(args.test_command, env=env_dict, stdout=subprocess.PIPE) # Meson categorizes a passing TODO test point as bad # (https://github.com/mesonbuild/meson/issues/13183). Remove the TODO -- 2.45.2