From a197604af44aae044d324d5a77125b9c5a0ee6bb Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sat, 23 Nov 2024 16:11:36 +0100 Subject: [PATCH 01/12] mkosi: update to latest --- .github/workflows/mkosi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mkosi.yml b/.github/workflows/mkosi.yml index 3914a56eb8..a7dee7ee25 100644 --- a/.github/workflows/mkosi.yml +++ b/.github/workflows/mkosi.yml @@ -105,7 +105,7 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - uses: systemd/mkosi@8976a0abb19221e65300222f2d33067970cca0f1 + - uses: systemd/mkosi@0825cca8084674ec8fa27502134b1bc601f79e0c # Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space # immediately, we remove the files in the background. However, we first move them to a different location From 6fd5df60058f980530d43f5ae070fc57a5882d7a Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sat, 23 Nov 2024 22:29:31 +0100 Subject: [PATCH 02/12] mkosi: Add shellcheck to tools --- mkosi.conf.d/05-tools/mkosi.conf.d/arch.conf | 1 + mkosi.conf.d/05-tools/mkosi.conf.d/centos-fedora.conf | 1 + mkosi.conf.d/05-tools/mkosi.conf.d/debian-ubuntu.conf | 1 + mkosi.conf.d/05-tools/mkosi.conf.d/opensuse.conf | 1 + 4 files changed, 4 insertions(+) diff --git a/mkosi.conf.d/05-tools/mkosi.conf.d/arch.conf b/mkosi.conf.d/05-tools/mkosi.conf.d/arch.conf index 0a5621c1e6..757589f50d 100644 --- a/mkosi.conf.d/05-tools/mkosi.conf.d/arch.conf +++ b/mkosi.conf.d/05-tools/mkosi.conf.d/arch.conf @@ -11,5 +11,6 @@ ToolsTreePackages= python-jinja python-pytest ruff + shellcheck tpm2-tss util-linux-libs diff --git a/mkosi.conf.d/05-tools/mkosi.conf.d/centos-fedora.conf b/mkosi.conf.d/05-tools/mkosi.conf.d/centos-fedora.conf index e954d52f8a..86315b773a 100644 --- a/mkosi.conf.d/05-tools/mkosi.conf.d/centos-fedora.conf +++ b/mkosi.conf.d/05-tools/mkosi.conf.d/centos-fedora.conf @@ -16,3 +16,4 @@ ToolsTreePackages= tpm2-tss-devel python3-jinja2 python3-pytest + shellcheck diff --git a/mkosi.conf.d/05-tools/mkosi.conf.d/debian-ubuntu.conf b/mkosi.conf.d/05-tools/mkosi.conf.d/debian-ubuntu.conf index 2550c0f96e..b7cdc3d311 100644 --- a/mkosi.conf.d/05-tools/mkosi.conf.d/debian-ubuntu.conf +++ b/mkosi.conf.d/05-tools/mkosi.conf.d/debian-ubuntu.conf @@ -16,3 +16,4 @@ ToolsTreePackages= libtss2-dev python3-jinja2 python3-pytest + shellcheck diff --git a/mkosi.conf.d/05-tools/mkosi.conf.d/opensuse.conf b/mkosi.conf.d/05-tools/mkosi.conf.d/opensuse.conf index 658829f6cb..d4cc31488c 100644 --- a/mkosi.conf.d/05-tools/mkosi.conf.d/opensuse.conf +++ b/mkosi.conf.d/05-tools/mkosi.conf.d/opensuse.conf @@ -16,3 +16,4 @@ ToolsTreePackages= tss2-devel python3-jinja2 python3-pytest + ShellCheck From 506403f5612cfab8477573b040fe690737d5deb3 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sat, 23 Nov 2024 22:29:56 +0100 Subject: [PATCH 03/12] mkosi: Use bash to execute command -v command is only an executable on Fedora due to a downstream patch, on Arch for example it's only a builtin so we have to use bash to execute command -v to get proper results on Arch. --- mkosi.sanitizers/mkosi.postinst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mkosi.sanitizers/mkosi.postinst b/mkosi.sanitizers/mkosi.postinst index 593a8f99aa..ae60ab6519 100755 --- a/mkosi.sanitizers/mkosi.postinst +++ b/mkosi.sanitizers/mkosi.postinst @@ -93,7 +93,7 @@ wrap=( ) for bin in "${wrap[@]}"; do - if ! mkosi-chroot command -v "$bin" >/dev/null; then + if ! mkosi-chroot bash -c "command -v $bin" >/dev/null; then continue fi @@ -103,7 +103,7 @@ for bin in "${wrap[@]}"; do enable_lsan=0 fi - target="$(mkosi-chroot command -v "$bin")" + target="$(mkosi-chroot bash -c "command -v $bin")" mv "$BUILDROOT/$target" "$BUILDROOT/$target.orig" From fdc4706850011d187923b0205bb69e7f19d6694d Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sat, 23 Nov 2024 23:33:54 +0100 Subject: [PATCH 04/12] mkosi: Install clangd everywhere --- mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.conf | 1 + mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.conf | 1 + mkosi.images/build/mkosi.conf.d/opensuse/mkosi.conf | 1 + 3 files changed, 3 insertions(+) diff --git a/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.conf b/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.conf index 902ebeeb9c..d27ed82b41 100644 --- a/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.conf +++ b/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.conf @@ -13,6 +13,7 @@ Environment= [Content] Packages= + clang-devel compiler-rt gdb git-core diff --git a/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.conf b/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.conf index d4a977914f..5fb7dab758 100644 --- a/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.conf +++ b/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.conf @@ -15,6 +15,7 @@ Environment= [Content] Packages= apt + clangd erofs-utils git-core libclang-rt-dev diff --git a/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.conf b/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.conf index 4d6073a84e..0643cdc8b2 100644 --- a/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.conf +++ b/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.conf @@ -12,6 +12,7 @@ Environment= [Content] Packages= + clang diffutils erofs-utils gcc-c++ From 51cd3dec2aa8e925dd2b4996e5746f897c1063fa Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 24 Nov 2024 00:03:50 +0100 Subject: [PATCH 05/12] mkosi: Add dnf and dnf5 to sanitizer workaround list --- mkosi.sanitizers/mkosi.postinst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mkosi.sanitizers/mkosi.postinst b/mkosi.sanitizers/mkosi.postinst index ae60ab6519..a6b529a4d6 100755 --- a/mkosi.sanitizers/mkosi.postinst +++ b/mkosi.sanitizers/mkosi.postinst @@ -57,6 +57,8 @@ wrap=( delv dhcpd dig + dnf + dnf5 dmsetup dnsmasq findmnt From c859b310eda3f5ddd6672e5322e661963603b0d3 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 24 Nov 2024 10:50:02 +0100 Subject: [PATCH 06/12] mkosi: Add github CLI to tools --- mkosi.conf.d/05-tools/mkosi.conf.d/arch.conf | 1 + mkosi.conf.d/05-tools/mkosi.conf.d/debian-ubuntu.conf | 1 + mkosi.conf.d/05-tools/mkosi.conf.d/fedora.conf | 1 + mkosi.conf.d/05-tools/mkosi.conf.d/opensuse.conf | 1 + 4 files changed, 4 insertions(+) diff --git a/mkosi.conf.d/05-tools/mkosi.conf.d/arch.conf b/mkosi.conf.d/05-tools/mkosi.conf.d/arch.conf index 757589f50d..e26efa49cc 100644 --- a/mkosi.conf.d/05-tools/mkosi.conf.d/arch.conf +++ b/mkosi.conf.d/05-tools/mkosi.conf.d/arch.conf @@ -6,6 +6,7 @@ ToolsTreeDistribution=arch [Build] ToolsTreePackages= cryptsetup + github-cli libcap libmicrohttpd python-jinja diff --git a/mkosi.conf.d/05-tools/mkosi.conf.d/debian-ubuntu.conf b/mkosi.conf.d/05-tools/mkosi.conf.d/debian-ubuntu.conf index b7cdc3d311..5c7e06c771 100644 --- a/mkosi.conf.d/05-tools/mkosi.conf.d/debian-ubuntu.conf +++ b/mkosi.conf.d/05-tools/mkosi.conf.d/debian-ubuntu.conf @@ -6,6 +6,7 @@ ToolsTreeDistribution=|ubuntu [Build] ToolsTreePackages= + gh libblkid-dev libcap-dev libcryptsetup-dev diff --git a/mkosi.conf.d/05-tools/mkosi.conf.d/fedora.conf b/mkosi.conf.d/05-tools/mkosi.conf.d/fedora.conf index 0b6bd4a5a9..777c13f45c 100644 --- a/mkosi.conf.d/05-tools/mkosi.conf.d/fedora.conf +++ b/mkosi.conf.d/05-tools/mkosi.conf.d/fedora.conf @@ -5,4 +5,5 @@ ToolsTreeDistribution=fedora [Build] ToolsTreePackages= + gh ruff diff --git a/mkosi.conf.d/05-tools/mkosi.conf.d/opensuse.conf b/mkosi.conf.d/05-tools/mkosi.conf.d/opensuse.conf index d4cc31488c..6a9b21bd90 100644 --- a/mkosi.conf.d/05-tools/mkosi.conf.d/opensuse.conf +++ b/mkosi.conf.d/05-tools/mkosi.conf.d/opensuse.conf @@ -5,6 +5,7 @@ ToolsTreeDistribution=opensuse [Build] ToolsTreePackages= + gh pkgconfig(blkid) pkgconfig(libcap) pkgconfig(libcryptsetup) From 6d2fd490cf677979ac7ce0a4ab7b26f447cceb76 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Fri, 22 Nov 2024 22:37:34 +0100 Subject: [PATCH 07/12] integration-test-wrapper: Remove unneeded format strings --- test/integration-test-wrapper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/integration-test-wrapper.py b/test/integration-test-wrapper.py index a680ddee53..d9c035e99f 100755 --- a/test/integration-test-wrapper.py +++ b/test/integration-test-wrapper.py @@ -70,7 +70,7 @@ def main(): shell = bool(int(os.getenv("TEST_SHELL", "0"))) if shell and not sys.stderr.isatty(): - print(f"--interactive must be passed to meson test to use TEST_SHELL=1", file=sys.stderr) + print("--interactive must be passed to meson test to use TEST_SHELL=1", file=sys.stderr) exit(1) name = args.name + (f"-{i}" if (i := os.getenv("MESON_TEST_ITERATION")) else "") @@ -84,7 +84,7 @@ def main(): if not shell: dropin += textwrap.dedent( - f""" + """ [Unit] SuccessAction=exit SuccessActionExitStatus=123 From a2aacbfad56c21b259fd36487d4e579176ac8967 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sat, 23 Nov 2024 12:58:47 +0100 Subject: [PATCH 08/12] Move mypy.ini and ruff.toml to top level This allows reusing them for integration-test-wrapper.py as well. --- src/ukify/mypy.ini => mypy.ini | 0 src/ukify/ruff.toml => ruff.toml | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename src/ukify/mypy.ini => mypy.ini (100%) rename src/ukify/ruff.toml => ruff.toml (100%) diff --git a/src/ukify/mypy.ini b/mypy.ini similarity index 100% rename from src/ukify/mypy.ini rename to mypy.ini diff --git a/src/ukify/ruff.toml b/ruff.toml similarity index 100% rename from src/ukify/ruff.toml rename to ruff.toml From d6047d9fb5f9abef596c0d52f85ee40b230ee430 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sat, 23 Nov 2024 14:04:27 +0100 Subject: [PATCH 09/12] ukify: Fix typing error --- src/ukify/ukify.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ukify/ukify.py b/src/ukify/ukify.py index caa9a04000..06967b02b9 100755 --- a/src/ukify/ukify.py +++ b/src/ukify/ukify.py @@ -467,7 +467,7 @@ class SignTool: raise NotImplementedError() @staticmethod - def from_string(name) -> type['SignTool']: + def from_string(name: str) -> type['SignTool']: if name == 'pesign': return PeSign elif name == 'sbsign': From 4f969b20b03095c62082c73609216a705b60df89 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sat, 23 Nov 2024 12:59:32 +0100 Subject: [PATCH 10/12] test: Format integration-test-wrapper.py --- test/integration-test-wrapper.py | 136 +++++++++++++++++-------------- 1 file changed, 75 insertions(+), 61 deletions(-) diff --git a/test/integration-test-wrapper.py b/test/integration-test-wrapper.py index d9c035e99f..30b9d8b172 100755 --- a/test/integration-test-wrapper.py +++ b/test/integration-test-wrapper.py @@ -1,8 +1,7 @@ #!/usr/bin/python3 # SPDX-License-Identifier: LGPL-2.1-or-later -'''Test wrapper command for driving integration tests. -''' +"""Test wrapper command for driving integration tests.""" import argparse import json @@ -13,7 +12,6 @@ import sys import textwrap from pathlib import Path - EMERGENCY_EXIT_DROPIN = """\ [Unit] Wants=emergency-exit.service @@ -46,34 +44,43 @@ def main(): parser.add_argument('--slow', action=argparse.BooleanOptionalAction) parser.add_argument('--vm', action=argparse.BooleanOptionalAction) parser.add_argument('--exit-code', required=True, type=int) - parser.add_argument('mkosi_args', nargs="*") + parser.add_argument('mkosi_args', nargs='*') 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.name}", file=sys.stderr) + if not bool(int(os.getenv('SYSTEMD_INTEGRATION_TESTS', '0'))): + 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.name}", file=sys.stderr) + 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.name}', + file=sys.stderr, + ) exit(77) - if args.vm and bool(int(os.getenv("TEST_NO_QEMU", "0"))): - print(f"TEST_NO_QEMU=1, skipping {args.name}", file=sys.stderr) + if args.vm and bool(int(os.getenv('TEST_NO_QEMU', '0'))): + print(f'TEST_NO_QEMU=1, skipping {args.name}', file=sys.stderr) exit(77) - for s in os.getenv("TEST_SKIP", "").split(): + for s in os.getenv('TEST_SKIP', '').split(): if s in args.name: - print(f"Skipping {args.name} due to TEST_SKIP", file=sys.stderr) + print(f'Skipping {args.name} due to TEST_SKIP', file=sys.stderr) exit(77) - keep_journal = os.getenv("TEST_SAVE_JOURNAL", "fail") - shell = bool(int(os.getenv("TEST_SHELL", "0"))) + keep_journal = os.getenv('TEST_SAVE_JOURNAL', 'fail') + shell = bool(int(os.getenv('TEST_SHELL', '0'))) if shell and not sys.stderr.isatty(): - print("--interactive must be passed to meson test to use TEST_SHELL=1", file=sys.stderr) + print( + '--interactive must be passed to meson test to use TEST_SHELL=1', + file=sys.stderr, + ) exit(1) - name = args.name + (f"-{i}" if (i := os.getenv("MESON_TEST_ITERATION")) else "") + name = args.name + (f'-{i}' if (i := os.getenv('MESON_TEST_ITERATION')) else '') dropin = textwrap.dedent( """\ @@ -91,7 +98,7 @@ def main(): """ ) - if os.getenv("TEST_MATCH_SUBTEST"): + if os.getenv('TEST_MATCH_SUBTEST'): dropin += textwrap.dedent( f""" [Service] @@ -99,7 +106,7 @@ def main(): """ ) - if os.getenv("TEST_MATCH_TESTCASE"): + if os.getenv('TEST_MATCH_TESTCASE'): dropin += textwrap.dedent( f""" [Service] @@ -116,7 +123,7 @@ def main(): """ ) - journal_file = (args.meson_build_dir / (f"test/journal/{name}.journal")).absolute() + journal_file = (args.meson_build_dir / (f'test/journal/{name}.journal')).absolute() journal_file.unlink(missing_ok=True) elif not shell: dropin += textwrap.dedent( @@ -136,42 +143,42 @@ def main(): *(['--forward-journal', journal_file] if journal_file else []), *( [ - '--credential', - f"systemd.extra-unit.emergency-exit.service={shlex.quote(EMERGENCY_EXIT_SERVICE)}", - '--credential', - f"systemd.unit-dropin.emergency.target={shlex.quote(EMERGENCY_EXIT_DROPIN)}", + '--credential', f'systemd.extra-unit.emergency-exit.service={shlex.quote(EMERGENCY_EXIT_SERVICE)}', # noqa: E501 + '--credential', f'systemd.unit-dropin.emergency.target={shlex.quote(EMERGENCY_EXIT_DROPIN)}', ] if not sys.stderr.isatty() else [] ), - '--credential', - f"systemd.unit-dropin.{args.unit}={shlex.quote(dropin)}", + '--credential', f'systemd.unit-dropin.{args.unit}={shlex.quote(dropin)}', '--runtime-network=none', '--runtime-scratch=no', *args.mkosi_args, - '--qemu-firmware', args.firmware, - *(['--qemu-kvm', 'no'] if int(os.getenv("TEST_NO_KVM", "0")) else []), + '--qemu-firmware', + args.firmware, + *(['--qemu-kvm', 'no'] if int(os.getenv('TEST_NO_KVM', '0')) else []), '--kernel-command-line-extra', - ' '.join([ - 'systemd.hostname=H', - f"SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/{args.name}.units:/usr/lib/systemd/tests/testdata/units:", - *([f"systemd.unit={args.unit}"] if not shell else []), - 'systemd.mask=systemd-networkd-wait-online.service', - *( - [ - "systemd.mask=serial-getty@.service", - "systemd.show_status=error", - "systemd.crash_shell=0", - "systemd.crash_action=poweroff", - ] - if not sys.stderr.isatty() - else [] - ), - ]), + ' '.join( + [ + 'systemd.hostname=H', + f'SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/{args.name}.units:/usr/lib/systemd/tests/testdata/units:', + *([f'systemd.unit={args.unit}'] if not shell else []), + 'systemd.mask=systemd-networkd-wait-online.service', + *( + [ + 'systemd.mask=serial-getty@.service', + 'systemd.show_status=error', + 'systemd.crash_shell=0', + 'systemd.crash_action=poweroff', + ] + if not sys.stderr.isatty() + else [] + ), + ] + ), '--credential', f"journal.storage={'persistent' if sys.stderr.isatty() else args.storage}", *(['--runtime-build-sources=no'] if not sys.stderr.isatty() else []), 'qemu' if args.vm or os.getuid() != 0 else 'boot', - ] + ] # fmt: skip result = subprocess.run(cmd) @@ -180,10 +187,15 @@ def main(): journal_file.unlink(missing_ok=True) result = subprocess.run(cmd) if args.vm and result.returncode == 247 and args.exit_code != 247: - print(f"Test {args.name} failed due to QEMU crash (error 247), ignoring", file=sys.stderr) + print( + f'Test {args.name} failed due to QEMU crash (error 247), ignoring', + file=sys.stderr, + ) exit(77) - if journal_file and (keep_journal == "0" or (result.returncode in (args.exit_code, 77) and keep_journal == "fail")): + if journal_file and ( + keep_journal == '0' or (result.returncode in (args.exit_code, 77) and keep_journal == 'fail') + ): journal_file.unlink(missing_ok=True) if shell or result.returncode in (args.exit_code, 77): @@ -192,31 +204,33 @@ def main(): if journal_file: ops = [] - if os.getenv("GITHUB_ACTIONS"): - id = os.environ["GITHUB_RUN_ID"] - iteration = os.environ["GITHUB_RUN_ATTEMPT"] + if os.getenv('GITHUB_ACTIONS'): + id = os.environ['GITHUB_RUN_ID'] + iteration = os.environ['GITHUB_RUN_ATTEMPT'] j = json.loads( subprocess.run( [ args.mkosi, - "--directory", os.fspath(args.meson_source_dir), - "--json", - "summary", + '--directory', os.fspath(args.meson_source_dir), + '--json', + 'summary', ], stdout=subprocess.PIPE, text=True, ).stdout - ) - distribution = j["Images"][-1]["Distribution"] - release = j["Images"][-1]["Release"] - artifact = f"ci-mkosi-{id}-{iteration}-{distribution}-{release}-failed-test-journals" - ops += [f"gh run download {id} --name {artifact} -D ci/{artifact}"] - journal_file = Path(f"ci/{artifact}/test/journal/{name}.journal") + ) # fmt: skip + distribution = j['Images'][-1]['Distribution'] + release = j['Images'][-1]['Release'] + artifact = f'ci-mkosi-{id}-{iteration}-{distribution}-{release}-failed-test-journals' + 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 {args.unit} -p info"] + ops += [f'journalctl --file {journal_file} --no-hostname -o short-monotonic -u {args.unit} -p info'] - print("Test failed, relevant logs can be viewed with: \n\n" - f"{(' && '.join(ops))}\n", file=sys.stderr) + print( + "Test failed, relevant logs can be viewed with: \n\n" f"{(' && '.join(ops))}\n", + file=sys.stderr, + ) # 0 also means we failed so translate that to a non-zero exit code to mark the test as failed. exit(result.returncode or 1) From ceca7c500563c59b70f43887e4593203a5de2052 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sat, 23 Nov 2024 13:01:00 +0100 Subject: [PATCH 11/12] test: Fix typing errors in integration-test-wrapper.py --- test/integration-test-wrapper.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/integration-test-wrapper.py b/test/integration-test-wrapper.py index 30b9d8b172..737bbd4272 100755 --- a/test/integration-test-wrapper.py +++ b/test/integration-test-wrapper.py @@ -32,7 +32,7 @@ ExecStart=false """ -def main(): +def main() -> None: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--mkosi', required=True) parser.add_argument('--meson-source-dir', required=True, type=Path) @@ -184,7 +184,8 @@ def main(): # On Debian/Ubuntu we get a lot of random QEMU crashes. Retry once, and then skip if it fails again. if args.vm and result.returncode == 247 and args.exit_code != 247: - journal_file.unlink(missing_ok=True) + if journal_file: + journal_file.unlink(missing_ok=True) result = subprocess.run(cmd) if args.vm and result.returncode == 247 and args.exit_code != 247: print( From f458a60391f7175c9f1df7fd45c7706d02f8b233 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sat, 23 Nov 2024 12:54:02 +0100 Subject: [PATCH 12/12] test: Lint integration-test-wrapper.py --- .github/workflows/linter.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index bf93682bd8..d9f6a37680 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -37,7 +37,7 @@ jobs: VALIDATE_GITHUB_ACTIONS: true - name: Check that tabs are not used in Python code - run: sh -c '! git grep -P "\\t" -- src/ukify/ukify.py' + run: sh -c '! git grep -P "\\t" -- src/ukify/ukify.py test/integration-test-wrapper.py' - name: Install ruff and mypy run: | @@ -47,14 +47,14 @@ jobs: - name: Run mypy run: | python3 -m mypy --version - python3 -m mypy src/ukify/ukify.py + python3 -m mypy src/ukify/ukify.py test/integration-test-wrapper.py - name: Run ruff check run: | ruff --version - ruff check src/ukify/ukify.py + ruff check src/ukify/ukify.py test/integration-test-wrapper.py - name: Run ruff format run: | ruff --version - ruff format --check src/ukify/ukify.py + ruff format --check src/ukify/ukify.py test/integration-test-wrapper.py