]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: Use MESON_TEST_ITERATION if available
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 3 May 2024 08:57:50 +0000 (10:57 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 6 May 2024 08:56:54 +0000 (10:56 +0200)
This allows running the same test multiple times concurrently with
meson's --repeat option. Proposed upstream but not yet merged:
https://github.com/mesonbuild/meson/pull/13177.

test/integration-test-wrapper.py

index e3dcf75239f76629cfc15d3611c1d74aa8462efc..99ae43ac8314c09bc85d4a662d10c9a35d5a295b 100755 (executable)
@@ -51,6 +51,7 @@ def main():
     parser.add_argument('mkosi_args', nargs="*")
     args = parser.parse_args()
 
+    name = args.test_name + (f"-{i}" if (i := os.getenv("MESON_TEST_ITERATION")) else "")
     test_unit = f"testsuite-{args.test_number}.service"
 
     dropin = textwrap.dedent(
@@ -90,7 +91,7 @@ def main():
             """
         )
 
-        journal_file = (args.meson_build_dir / (f"test/journal/{args.test_name}.journal")).absolute()
+        journal_file = (args.meson_build_dir / (f"test/journal/{name}.journal")).absolute()
         journal_file.unlink(missing_ok=True)
     else:
         journal_file = None
@@ -100,7 +101,7 @@ def main():
         '--directory', os.fspath(args.meson_source_dir),
         '--output-dir', os.fspath(args.meson_build_dir / 'mkosi.output'),
         '--extra-search-path', os.fspath(args.meson_build_dir),
-        '--machine', args.test_name,
+        '--machine', name,
         '--ephemeral',
         *(['--forward-journal', journal_file] if journal_file else []),
         *(