From 0bc1e9592e963cc20d54188f113c839bfe576788 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Tue, 23 Apr 2024 16:41:39 +0100 Subject: [PATCH 1/8] 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 4bd33179b0..da06074618 100644 --- a/.github/workflows/mkosi.yml +++ b/.github/workflows/mkosi.yml @@ -71,7 +71,7 @@ jobs: steps: - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - - uses: systemd/mkosi@8cbde8a4ed20a078ad5c70fe38c0dd2294a68bb1 + - uses: systemd/mkosi@11b112094e659d50cdb25f67829857cfefb69e6d # 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 796cf1b4838467b1c2da80aa1101ec236390914d Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Mon, 25 Mar 2024 17:43:44 +0000 Subject: [PATCH 2/8] test: document when writable /usr overlays may be needed --- test/units/testsuite-15.sh | 1 + test/units/testsuite-26.sh | 1 + test/units/testsuite-60.sh | 1 + test/units/testsuite-73.sh | 1 + 4 files changed, 4 insertions(+) diff --git a/test/units/testsuite-15.sh b/test/units/testsuite-15.sh index 0266f6266f..204fa99219 100755 --- a/test/units/testsuite-15.sh +++ b/test/units/testsuite-15.sh @@ -8,6 +8,7 @@ set -o pipefail # shellcheck source=test/units/util.sh . "$(dirname "$0")"/util.sh +# Needed to write units to /usr/lib/systemd/system to test /etc and /run overrides. maybe_mount_usr_overlay trap 'maybe_umount_usr_overlay' EXIT diff --git a/test/units/testsuite-26.sh b/test/units/testsuite-26.sh index 2dd62a4f67..6734aee654 100755 --- a/test/units/testsuite-26.sh +++ b/test/units/testsuite-26.sh @@ -18,6 +18,7 @@ at_exit() { return 0 } +# Needed for /usr/lib/systemd/system/$UNIT_NAME to test overrides in /etc and /run maybe_mount_usr_overlay trap at_exit EXIT diff --git a/test/units/testsuite-60.sh b/test/units/testsuite-60.sh index 3d0723e7dc..c777de8526 100755 --- a/test/units/testsuite-60.sh +++ b/test/units/testsuite-60.sh @@ -6,6 +6,7 @@ set -o pipefail # shellcheck source=test/units/util.sh . "$(dirname "$0")"/util.sh +# Needed to create mount.mytmpfs helper maybe_mount_usr_overlay trap 'maybe_umount_usr_overlay' EXIT diff --git a/test/units/testsuite-73.sh b/test/units/testsuite-73.sh index 3e5b78879a..59f84f20ab 100755 --- a/test/units/testsuite-73.sh +++ b/test/units/testsuite-73.sh @@ -9,6 +9,7 @@ set -o pipefail # shellcheck source=test/units/util.sh . "$(dirname "$0")"/util.sh +# Needed to generate test locales in /usr/lib maybe_mount_usr_overlay trap 'maybe_umount_usr_overlay' EXIT From 2fd849016b7368f64f591833a2be752e68cd5052 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Tue, 23 Apr 2024 14:13:22 +0100 Subject: [PATCH 3/8] test: Shut down tests on crash If an assert in systemd fails it can't shut down normally. By default it freezes. For interactive runs we want the crash shell to enable further debugging, but during test runs we want it to exit without having to wait for the test timeout. By deactivating the crash shell, enabling reboot, and configuring qemu so that it shuts down instead of rebooting we can shut down instead. Because by default UEFI will enroll keys and then reboot we also have to set --qemu-firmware-variables=custom so it doesn't need to auto-enroll. Because mkosi has to handle not receiving an EXIT_STATUS notification it falls back to the exit code of qemu, which in the case of reboot would be 0, we also override the success exit status to 123 and check that we got that as an exit code from mkosi. --- test/integration-test-wrapper.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test/integration-test-wrapper.py b/test/integration-test-wrapper.py index b89975d13d..eb7b5b3fc5 100755 --- a/test/integration-test-wrapper.py +++ b/test/integration-test-wrapper.py @@ -64,6 +64,7 @@ def main(): """ [Unit] SuccessAction=exit + SuccessActionExitStatus=123 FailureAction=exit """ ) @@ -87,7 +88,9 @@ def main(): f"systemd.extra-unit.emergency-exit.service={shlex.quote(EMERGENCY_EXIT_SERVICE)}", '--credential', f"systemd.unit-dropin.emergency.target={shlex.quote(EMERGENCY_EXIT_DROPIN)}", - '--kernel-command-line-extra=systemd.mask=serial-getty@.service', + '--kernel-command-line-extra=systemd.mask=serial-getty@.service systemd.show_status=no systemd.crash_shell=0 systemd.crash_reboot', + # Custom firmware variables allow bypassing the EFI auto-enrollment reboot so we only reboot on crash + '--qemu-firmware-variables=custom', ] if not sys.stderr.isatty() else [] @@ -103,12 +106,13 @@ def main(): ]), *args.mkosi_args, 'qemu', + *(['-no-reboot'] if not sys.stderr.isatty() else []) ] - try: - subprocess.run(cmd, check=True) - except subprocess.CalledProcessError as e: - if e.returncode != 77 and journal_file: + result = subprocess.run(cmd) + # Return code 123 is the expected success code + if result.returncode != (0 if sys.stderr.isatty() else 123): + if result.returncode != 77 and journal_file: cmd = [ 'journalctl', '--no-hostname', @@ -119,7 +123,7 @@ def main(): ] print("Test failed, relevant logs can be viewed with: \n\n" f"{shlex.join(str(a) for a in cmd)}\n", file=sys.stderr) - exit(e.returncode) + exit(result.returncode or 1) # Do not keep journal files for tests that don't fail. if journal_file: From bad25450b8ba450dabafae1200da200707461aa5 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Tue, 23 Apr 2024 19:39:38 +0100 Subject: [PATCH 4/8] mkosi: Add psmisc to arch for killall --- mkosi.images/system/mkosi.conf.d/10-arch/mkosi.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.conf b/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.conf index cf5d4f3103..3007510b0d 100644 --- a/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.conf +++ b/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.conf @@ -36,6 +36,7 @@ Packages= pkgconf polkit procps-ng + psmisc quota-tools sbsigntools shadow From f744ccd5fe7b9aaba09500910ff57c4b42e14555 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Tue, 23 Apr 2024 10:34:16 +0100 Subject: [PATCH 5/8] mkosi: Add psmisc to debian-ubuntu for killall --- mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf index ce80e5513f..7446da0914 100644 --- a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf +++ b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf @@ -58,6 +58,7 @@ Packages= passwd policykit-1 procps + psmisc quota sbsigntool tzdata From fab270d73e5dd82865b8896a9cf125fa2d021580 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Tue, 23 Apr 2024 21:44:30 +0100 Subject: [PATCH 6/8] mkosi: Add psmisc to opensuse for killall --- mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf index 5bcf7b8efd..d3801f419e 100644 --- a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf +++ b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf @@ -53,6 +53,7 @@ Packages= pam patterns-base-minimal_base procps4 + psmisc python3-pefile quota rpm-build From ab7253e1ecfeba6973adc5d2d76f41ace104c246 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 24 Apr 2024 11:02:48 +0200 Subject: [PATCH 7/8] mkosi: Add nvme-cli The nvme command is needed for TEST-84-STORAGETM. --- mkosi.images/system/mkosi.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/mkosi.images/system/mkosi.conf b/mkosi.images/system/mkosi.conf index 90f302e44d..e07ff1b998 100644 --- a/mkosi.images/system/mkosi.conf +++ b/mkosi.images/system/mkosi.conf @@ -29,6 +29,7 @@ Packages= mtools nano nftables + nvme-cli openssl python3 qrencode From 2c139de2541f3181ceb21e53d739cb788fb6aabd Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 24 Apr 2024 11:03:14 +0200 Subject: [PATCH 8/8] mkosi: Add attr Required for messing around with xattrs in integration tests. --- mkosi.images/system/mkosi.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/mkosi.images/system/mkosi.conf b/mkosi.images/system/mkosi.conf index e07ff1b998..a65caf58d8 100644 --- a/mkosi.images/system/mkosi.conf +++ b/mkosi.images/system/mkosi.conf @@ -10,6 +10,7 @@ ExtraTrees= Packages= acl + attr bash-completion coreutils diffutils