From 7f07f9c8cdbcca3b57e40143e86e7179420d39db Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Fri, 28 Jun 2024 12:50:49 +0200 Subject: [PATCH 01/11] TEST-64-UDEV-STORAGE: Use bus pci slot 1 instead of 0 Trying to use bus pci slot 0 fails on aarch64 so let's use 1 instead. The error: """ qemu-system-aarch64: -device virtio-blk-pci,drive=drive0,scsi=off,bus=pci_bridge25: Unsupported PCI slot 0 for standard hotplug controller. Valid slots are between 1 and 31. """ --- test/TEST-64-UDEV-STORAGE/long_sysfs_path.configure | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/TEST-64-UDEV-STORAGE/long_sysfs_path.configure b/test/TEST-64-UDEV-STORAGE/long_sysfs_path.configure index 6108bdb981..6e8e3124ba 100755 --- a/test/TEST-64-UDEV-STORAGE/long_sysfs_path.configure +++ b/test/TEST-64-UDEV-STORAGE/long_sysfs_path.configure @@ -23,10 +23,9 @@ config["QemuArgs"] += ["-device", "pci-bridge,id=pci_bridge0,chassis_nr=64"] for bridge in range(1, 26): config["QemuArgs"] += [ "-device", - f"pci-bridge,id=pci_bridge{bridge},bus=pci_bridge{bridge - 1}," - f"chassis_nr={64 + bridge}" + f"pci-bridge,id=pci_bridge{bridge},bus=pci_bridge{bridge - 1},chassis_nr={64 + bridge},addr=1", ] -config["QemuArgs"] += ["-device", f"virtio-blk-pci,drive=drive0,scsi=off,bus=pci_bridge25"] +config["QemuArgs"] += ["-device", f"virtio-blk-pci,drive=drive0,scsi=off,bus=pci_bridge25,addr=1"] json.dump(config, sys.stdout) From 4e469c0af2e92914b324f0fb48cf4462caff5c86 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Fri, 28 Jun 2024 12:51:46 +0200 Subject: [PATCH 02/11] TEST-64-UDEV-STORAGE: Fix python 3.9 compatibility Using double quotes in f-strings only works from python 3.12 onwards. Use single quotes to make sure python 3.9 works as well. Also clean up quotes a little in general. --- test/TEST-64-UDEV-STORAGE/nvme_basic.configure | 4 ++-- test/TEST-64-UDEV-STORAGE/nvme_subsystem.configure | 4 ++-- .../virtio_scsi_identically_named_partitions.configure | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/TEST-64-UDEV-STORAGE/nvme_basic.configure b/test/TEST-64-UDEV-STORAGE/nvme_basic.configure index 37d0d356fd..28ddfa46c1 100755 --- a/test/TEST-64-UDEV-STORAGE/nvme_basic.configure +++ b/test/TEST-64-UDEV-STORAGE/nvme_basic.configure @@ -9,8 +9,8 @@ import sys config = json.load(sys.stdin) -qemu = f"qemu-system-{os.environ["QEMU_ARCHITECTURE"]}" -result = subprocess.run([qemu, '-device', 'help'], check=True, text=True, stdout=subprocess.PIPE) +qemu = f"qemu-system-{os.environ['QEMU_ARCHITECTURE']}" +result = subprocess.run([qemu, "-device", "help"], check=True, text=True, stdout=subprocess.PIPE) if 'name "nvme"' not in result.stdout: print("nvme device driver is not available, skipping test...", file=sys.stderr) exit(77) diff --git a/test/TEST-64-UDEV-STORAGE/nvme_subsystem.configure b/test/TEST-64-UDEV-STORAGE/nvme_subsystem.configure index eb601a6843..3d7900773c 100755 --- a/test/TEST-64-UDEV-STORAGE/nvme_subsystem.configure +++ b/test/TEST-64-UDEV-STORAGE/nvme_subsystem.configure @@ -9,8 +9,8 @@ import sys config = json.load(sys.stdin) -qemu = f"qemu-system-{os.environ["QEMU_ARCHITECTURE"]}" -result = subprocess.run([qemu, '-device', 'help'], check=True, text=True, stdout=subprocess.PIPE) +qemu = f"qemu-system-{os.environ['QEMU_ARCHITECTURE']}" +result = subprocess.run([qemu, "-device", "help"], check=True, text=True, stdout=subprocess.PIPE) if 'name "nvme"' not in result.stdout: print("nvme device driver is not available, skipping test...", file=sys.stderr) exit(77) diff --git a/test/TEST-64-UDEV-STORAGE/virtio_scsi_identically_named_partitions.configure b/test/TEST-64-UDEV-STORAGE/virtio_scsi_identically_named_partitions.configure index e850247c6a..edc5138ce8 100755 --- a/test/TEST-64-UDEV-STORAGE/virtio_scsi_identically_named_partitions.configure +++ b/test/TEST-64-UDEV-STORAGE/virtio_scsi_identically_named_partitions.configure @@ -9,8 +9,8 @@ import sys config = json.load(sys.stdin) -qemu = f"qemu-system-{os.environ["QEMU_ARCHITECTURE"]}" -result = subprocess.run([qemu, '-device', 'help'], check=True, text=True, stdout=subprocess.PIPE) +qemu = f"qemu-system-{os.environ['QEMU_ARCHITECTURE']}" +result = subprocess.run([qemu, "-device", "help"], check=True, text=True, stdout=subprocess.PIPE) if 'name "virtio-scsi-pci"' not in result.stdout: print("virtio-scsi-pci device driver is not available, skipping test...", file=sys.stderr) exit(77) From 32f3617fd700e4a98b35f8c28a2807c2e51a2d9f Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Fri, 28 Jun 2024 13:34:37 +0200 Subject: [PATCH 03/11] test: pull in multi-user.target explicitly Let's make sure we pull in multi-user.target so that we get a console when a test fails and we're running meson test with --interactive. --- test/integration-test-wrapper.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/integration-test-wrapper.py b/test/integration-test-wrapper.py index 21ec00680f..743a14c3d8 100755 --- a/test/integration-test-wrapper.py +++ b/test/integration-test-wrapper.py @@ -103,6 +103,12 @@ def main(): journal_file = (args.meson_build_dir / (f"test/journal/{name}.journal")).absolute() journal_file.unlink(missing_ok=True) else: + dropin += textwrap.dedent( + """ + [Unit] + Wants=multi-user.target + """ + ) journal_file = None cmd = [ From 3cdc8da5ad4beb9bdb06e9c6ca3544da410454ce Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Fri, 28 Jun 2024 13:41:12 +0200 Subject: [PATCH 04/11] mkosi: Install pciutils --- 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 d1ab822132..d1632f19f2 100644 --- a/mkosi.images/system/mkosi.conf +++ b/mkosi.images/system/mkosi.conf @@ -57,6 +57,7 @@ Packages= opensc openssl p11-kit + pciutils python3 qrencode radvd From 72d121b60174b825bf1390958eb1b55f34c5ff5b Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Fri, 28 Jun 2024 14:20:34 +0200 Subject: [PATCH 05/11] TEST-64-UDEV-STORAGE: Make nvme_subsystem expected pci symlinks more generic When running the test on aarch64 the symlinks look as follows: """ [root@H ~]# ls /dev/disk/by-path platform-4010000000.pcie-pci-0000:00:04.0-scsi-0:0:0:0 platform-4010000000.pcie-pci-0000:00:04.0-scsi-0:0:0:0-part1 platform-4010000000.pcie-pci-0000:00:05.0-nvme-16 platform-4010000000.pcie-pci-0000:00:04.0-scsi-0:0:0:0-part platform-4010000000.pcie-pci-0000:00:04.0-scsi-0:0:0:0-part2 platform-4010000000.pcie-pci-0000:00:05.0-nvme-17 """ So let's make the PCI patterns a little more generic so they match both the x86 and the aarch64 paths. --- test/units/TEST-64-UDEV-STORAGE.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/units/TEST-64-UDEV-STORAGE.sh b/test/units/TEST-64-UDEV-STORAGE.sh index 5ddddf549b..431b5305e4 100755 --- a/test/units/TEST-64-UDEV-STORAGE.sh +++ b/test/units/TEST-64-UDEV-STORAGE.sh @@ -231,8 +231,8 @@ testcase_nvme_subsystem() { /dev/disk/by-id/nvme-QEMU_NVMe_Ctrl_deadbeef_16 /dev/disk/by-id/nvme-QEMU_NVMe_Ctrl_deadbeef_17 # Shared namespaces - /dev/disk/by-path/pci-*-nvme-16 - /dev/disk/by-path/pci-*-nvme-17 + /dev/disk/by-path/*pci*-nvme-16 + /dev/disk/by-path/*pci*-nvme-17 ) udevadm wait --settle --timeout=30 "${expected_symlinks[@]}" From 24284098a4613e626368ebe06ea6e39e49a9bc0f Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Fri, 28 Jun 2024 14:51:10 +0200 Subject: [PATCH 06/11] TEST-45-TIMEDATE: Use syslog identifier journalctl match Using a unit match is racy whereas a syslog identifier match is reliable. --- test/units/TEST-45-TIMEDATE.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/units/TEST-45-TIMEDATE.sh b/test/units/TEST-45-TIMEDATE.sh index dff3ed0b9e..420ebefd01 100755 --- a/test/units/TEST-45-TIMEDATE.sh +++ b/test/units/TEST-45-TIMEDATE.sh @@ -218,7 +218,7 @@ assert_ntp() { assert_timedated_signal() { local timestamp="${1:?}" local value="${2:?}" - local args=(-q -n 1 --since="$timestamp" -p info _SYSTEMD_UNIT="busctl-monitor.service") + local args=(-q -n 1 --since="$timestamp" -p info -t busctl) journalctl --sync @@ -298,7 +298,7 @@ assert_timesyncd_signal() { local timestamp="${1:?}" local property="${2:?}" local value="${3:?}" - local args=(-q --since="$timestamp" -p info _SYSTEMD_UNIT="busctl-monitor.service") + local args=(-q --since="$timestamp" -p info -t busctl) journalctl --sync From 98f2a332cb1a3efc3b2e8a5914a895a0a051bda4 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Fri, 28 Jun 2024 15:28:16 +0200 Subject: [PATCH 07/11] TEST-70-TPM2: Use UEFI firmware if available On x86 this doesn't matter but on aarch64 we need to make sure UEFI is used so that /sys/kernel/security/tpm0/binary_bios_measurements is there which is required for TEST-70-TPM2. --- test/TEST-70-TPM2/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/test/TEST-70-TPM2/meson.build b/test/TEST-70-TPM2/meson.build index d84c2b7838..88368646b4 100644 --- a/test/TEST-70-TPM2/meson.build +++ b/test/TEST-70-TPM2/meson.build @@ -8,5 +8,6 @@ integration_tests += [ 'after' : '@0@ tpm2.target'.format(integration_test_template['configuration']['after']), }, 'vm' : true, + 'firmware' : 'auto', }, ] From 7c04137a6f09f8536ea3dfb667bd5a862fe945f1 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Fri, 28 Jun 2024 15:50:35 +0200 Subject: [PATCH 08/11] TEST-06-SELINUX: Explicitly pull in autorelabel.service --- test/TEST-06-SELINUX/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/TEST-06-SELINUX/meson.build b/test/TEST-06-SELINUX/meson.build index 9261a49c49..5036b64d9a 100644 --- a/test/TEST-06-SELINUX/meson.build +++ b/test/TEST-06-SELINUX/meson.build @@ -3,7 +3,7 @@ integration_tests += [ integration_test_template + { 'name' : fs.name(meson.current_source_dir()), - 'cmdline' : integration_test_template['cmdline'] + ['selinux=1', 'lsm=selinux'], + 'cmdline' : integration_test_template['cmdline'] + ['systemd.wants=autorelabel.service', 'selinux=1', 'lsm=selinux'], # FIXME; Figure out why reboot sometimes hangs with 'linux' firmware. # Use 'auto' to automatically fallback on non-uefi architectures. 'firmware' : 'auto', From 3cf38516bb765126fee80fed6d984ae963d075de Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Fri, 28 Jun 2024 16:19:38 +0200 Subject: [PATCH 09/11] TEST-09-REBOOT: Set auto firmware This test runs in nspawn by default but will still run in qemu when tests are run unprivileged so make sure we use UEFI if available to avoid hangs when using the linux firmware. --- test/TEST-09-REBOOT/meson.build | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/TEST-09-REBOOT/meson.build b/test/TEST-09-REBOOT/meson.build index b7556189f5..3e46a73e5d 100644 --- a/test/TEST-09-REBOOT/meson.build +++ b/test/TEST-09-REBOOT/meson.build @@ -4,5 +4,8 @@ integration_tests += [ integration_test_template + { 'name' : fs.name(meson.current_source_dir()), 'storage' : 'persistent', + # FIXME: Figure out why reboot sometimes hangs with 'linux' firmware. + # Use 'auto' to automatically fallback on non-uefi architectures. + 'firmware' : 'auto', }, ] From f392be9e7756268fc1b9d5204adc642bee10c8fa Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Fri, 28 Jun 2024 16:21:51 +0200 Subject: [PATCH 10/11] TEST-18-FAILUREACTION: Set auto firmware This test runs in nspawn by default but will still run in qemu when tests are run unprivileged so make sure we use UEFI if available to avoid hangs when using the linux firmware. --- test/TEST-18-FAILUREACTION/meson.build | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/TEST-18-FAILUREACTION/meson.build b/test/TEST-18-FAILUREACTION/meson.build index 8dec5f37e7..ee96008d4a 100644 --- a/test/TEST-18-FAILUREACTION/meson.build +++ b/test/TEST-18-FAILUREACTION/meson.build @@ -3,5 +3,8 @@ integration_tests += [ integration_test_template + { 'name' : fs.name(meson.current_source_dir()), + # FIXME: Figure out why reboot sometimes hangs with 'linux' firmware. + # Use 'auto' to automatically fallback on non-uefi architectures. + 'firmware' : 'auto', }, ] From 436474dd4348d5f12f70d9032d1cc45171b335e7 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Fri, 28 Jun 2024 16:22:15 +0200 Subject: [PATCH 11/11] TEST-54-CREDS: Use UEFI firmware if available On aarch64, SMBIOS is only available when using UEFI, so let's make sure that the creds test uses UEFI when available so that it can read creds from SMBIOS when running in a virtual machine. --- test/TEST-54-CREDS/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/test/TEST-54-CREDS/meson.build b/test/TEST-54-CREDS/meson.build index 8edb043a51..f725035e3f 100644 --- a/test/TEST-54-CREDS/meson.build +++ b/test/TEST-54-CREDS/meson.build @@ -27,5 +27,6 @@ integration_tests += [ '-smbios', 'type=11,value=io.systemd.credential.binary:fstab.extra=aW5qZWN0ZWQgL2luamVjdGVkIHRtcGZzIFgtbW91bnQubWtkaXIgMCAwCg==', '-smbios', 'type=11,value=io.systemd.credential:getty.ttys.container=idontexist', ], + 'firmware' : 'auto', }, ]