1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-08 08:58:27 +03:00

test: Use MESON_TEST_ITERATION if available

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.
This commit is contained in:
Daan De Meyer 2024-05-03 10:57:50 +02:00
parent 3cb61e0d1c
commit 0596237e0e

View File

@ -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 []),
*(