From: Michal Nowak Date: Tue, 2 Jun 2026 09:36:43 +0000 (+0000) Subject: Avoid leaking FLAKY into every unit test X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd1260e67519358f37abbec0925d049038678fd3;p=thirdparty%2Fbind9.git Avoid leaking FLAKY into every unit test meson stores the test env by reference, so mutating the shared test_env leaked FLAKY and TIMEOUT into all later tests. Build a fresh environment for flaky tests instead. Assisted-by: Claude:claude-opus-4-8 --- diff --git a/meson.build b/meson.build index 6ddda6b785c..15bca2e015b 100644 --- a/meson.build +++ b/meson.build @@ -273,13 +273,12 @@ env = environment( ) # Meson defines these variables in unit tests when not set -test_env = environment( - { - 'ASAN_OPTIONS': asan_options, - 'TSAN_OPTIONS': tsan_options, - 'UBSAN_OPTIONS': ubsan_options, - }, -) +test_env_vars = { + 'ASAN_OPTIONS': asan_options, + 'TSAN_OPTIONS': tsan_options, + 'UBSAN_OPTIONS': ubsan_options, +} +test_env = environment(test_env_vars) ### Configuration config = configuration_data() diff --git a/tests/isc/meson.build b/tests/isc/meson.build index 77901819412..ca9933de391 100644 --- a/tests/isc/meson.build +++ b/tests/isc/meson.build @@ -100,16 +100,21 @@ foreach unit : isc_test suites = ['isc', 'cmocka'] timeout = 300 + unit_env = test_env if unit in flaky_isc_test suites += 'flaky' - # Pass FLAKY and TIMEOUT to the test wrapper so it can retry appropriately - test_env.set('FLAKY', '1') - test_env.set('TIMEOUT', timeout.to_string()) + # Pass FLAKY and TIMEOUT to the test wrapper so it can retry + # appropriately. Build a fresh environment instead of mutating the + # shared test_env, which meson stores by reference and would otherwise + # leak these variables into every other test. + unit_env = environment( + test_env_vars + {'FLAKY': '1', 'TIMEOUT': timeout.to_string()}, + ) endif test( unit, test_bin, - env: test_env, + env: unit_env, suite: suites, timeout: timeout, workdir: meson.current_source_dir(),