summaryrefslogtreecommitdiff
path: root/mesonbuild/mtest.py
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2024-05-03 10:05:24 +0200
committerEli Schwartz <eschwartz93@gmail.com>2024-05-08 08:05:44 -0400
commitbcaab91bf61327bb7c2a0259292c2a336ad6513a (patch)
treed36800aee4f941a14d85d3b419709e9d4f29448f /mesonbuild/mtest.py
parent14de8ac5a9e04490a67e3ddcbd44b31915aed1b9 (diff)
downloadmeson-bcaab91bf61327bb7c2a0259292c2a336ad6513a.tar.gz
mtest: Set MESON_TEST_ITERATION to the current iteration of the test
When running our integration tests in systemd we depend on each test having a unique name. This is always the case unless --repeat is used, in which case multiple tests with the same name run concurrently which causes issues when allocating resources that use the test name as the identifier. Let's set MESON_TEST_ITERATION to the current iteration of the test so we can use $TEST_NAME-$TEST_ITERATION as our test identifiers which will avoid these issues.
Diffstat (limited to 'mesonbuild/mtest.py')
-rw-r--r--mesonbuild/mtest.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py
index 460a44c49..03d2eb254 100644
--- a/mesonbuild/mtest.py
+++ b/mesonbuild/mtest.py
@@ -1709,7 +1709,7 @@ class TestHarness:
sys.exit('Conflict: both test setup and command line specify an exe wrapper.')
return current.env.get_env(os.environ.copy())
- def get_test_runner(self, test: TestSerialisation) -> SingleTestRunner:
+ def get_test_runner(self, test: TestSerialisation, iteration: int) -> SingleTestRunner:
name = self.get_pretty_suite(test)
options = deepcopy(self.options)
if self.options.setup:
@@ -1721,6 +1721,7 @@ class TestHarness:
if (test.is_cross_built and test.needs_exe_wrapper and
test.exe_wrapper and test.exe_wrapper.found()):
env['MESON_EXE_WRAPPER'] = join_args(test.exe_wrapper.get_command())
+ env['MESON_TEST_ITERATION'] = str(iteration + 1)
return SingleTestRunner(test, env, name, options)
def process_test_result(self, result: TestRun) -> None:
@@ -1822,7 +1823,7 @@ class TestHarness:
os.chdir(self.options.wd)
runners: T.List[SingleTestRunner] = []
for i in range(self.options.repeat):
- runners.extend(self.get_test_runner(test) for test in tests)
+ runners.extend(self.get_test_runner(test, i) for test in tests)
if i == 0:
self.duration_max_len = max(len(str(int(runner.timeout or 99)))
for runner in runners)