test: Simplify argument/variable names

This commit is contained in:
Daan De Meyer
2024-05-11 19:40:03 +02:00
parent 7a321b5a21
commit f483e08313
2 changed files with 10 additions and 10 deletions

View File

@@ -42,7 +42,7 @@ def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--meson-source-dir', required=True, type=Path)
parser.add_argument('--meson-build-dir', required=True, type=Path)
parser.add_argument('--test-name', required=True)
parser.add_argument('--name', required=True)
parser.add_argument('--storage', required=True)
parser.add_argument('--firmware', required=True)
parser.add_argument('--slow', action=argparse.BooleanOptionalAction)
@@ -50,15 +50,15 @@ def main():
args = parser.parse_args()
if not bool(int(os.getenv("SYSTEMD_INTEGRATION_TESTS", "0"))):
print(f"SYSTEMD_INTEGRATION_TESTS=1 not found in environment, skipping {args.test_name}", file=sys.stderr)
print(f"SYSTEMD_INTEGRATION_TESTS=1 not found in environment, skipping {args.name}", file=sys.stderr)
exit(77)
if args.slow and not bool(int(os.getenv("SYSTEMD_SLOW_TESTS", "0"))):
print(f"SYSTEMD_SLOW_TESTS=1 not found in environment, skipping {args.test_name}", file=sys.stderr)
print(f"SYSTEMD_SLOW_TESTS=1 not found in environment, skipping {args.name}", file=sys.stderr)
exit(77)
name = args.test_name + (f"-{i}" if (i := os.getenv("MESON_TEST_ITERATION")) else "")
test_unit = f"{args.test_name}.service"
name = args.name + (f"-{i}" if (i := os.getenv("MESON_TEST_ITERATION")) else "")
unit = f"{args.name}.service"
dropin = textwrap.dedent(
"""\
@@ -121,7 +121,7 @@ def main():
else []
),
'--credential',
f"systemd.unit-dropin.{test_unit}={shlex.quote(dropin)}",
f"systemd.unit-dropin.{unit}={shlex.quote(dropin)}",
'--runtime-network=none',
'--runtime-scratch=no',
'--append',
@@ -129,8 +129,8 @@ def main():
'--kernel-command-line-extra',
' '.join([
'systemd.hostname=H',
f"SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/{args.test_name}.units:/usr/lib/systemd/tests/testdata/units:",
f"systemd.unit={test_unit}",
f"SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/{args.name}.units:/usr/lib/systemd/tests/testdata/units:",
f"systemd.unit={unit}",
'systemd.mask=systemd-networkd-wait-online.service',
*(
[
@@ -183,7 +183,7 @@ def main():
ops += [f"gh run download {id} --name {artifact} -D ci/{artifact}"]
journal_file = Path(f"ci/{artifact}/test/journal/{name}.journal")
ops += [f"journalctl --file {journal_file} --no-hostname -o short-monotonic -u {test_unit} -p info"]
ops += [f"journalctl --file {journal_file} --no-hostname -o short-monotonic -u {unit} -p info"]
print("Test failed, relevant logs can be viewed with: \n\n"
f"{(' && '.join(ops))}\n", file=sys.stderr)

View File

@@ -370,7 +370,7 @@ foreach integration_test : integration_tests
integration_test_args = [
'--meson-source-dir', meson.project_source_root(),
'--meson-build-dir', meson.project_build_root(),
'--test-name', integration_test['name'],
'--name', integration_test['name'],
'--storage', integration_test['storage'],
'--firmware', integration_test['firmware'],
]