]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Avoid leaking FLAKY into every unit test
authorMichal Nowak <mnowak@isc.org>
Tue, 2 Jun 2026 09:36:43 +0000 (09:36 +0000)
committerMichal Nowak <mnowak@isc.org>
Tue, 30 Jun 2026 15:03:25 +0000 (17:03 +0200)
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
meson.build
tests/isc/meson.build

index 6ddda6b785cf3d0e67b9a54013df80f0155c8085..15bca2e015b421e757b0e5518b04f72e55955995 100644 (file)
@@ -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()
index 779018194125ec9794e649e8177237e1b5f68f54..ca9933de3912758c13d60391278ac5a5f20d8c49 100644 (file)
@@ -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(),