From ab5f60cb23d51c7edff2440be3f07abc810d6b79 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Thu, 25 Apr 2024 10:00:15 +0100 Subject: [PATCH 01/10] test: Disable network by default in mkosi tests --- test/integration-test-wrapper.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/integration-test-wrapper.py b/test/integration-test-wrapper.py index 4465576c5bc..2d2fba25ebb 100755 --- a/test/integration-test-wrapper.py +++ b/test/integration-test-wrapper.py @@ -102,6 +102,7 @@ def main(): ), '--credential', f"systemd.unit-dropin.{test_unit}={shlex.quote(dropin)}", + '--runtime-network=none', '--append', '--kernel-command-line-extra', ' '.join([ From 97509724551d7180b0a4d52f3dac33128ad39439 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Tue, 23 Apr 2024 21:39:04 +0100 Subject: [PATCH 02/10] mkosi: Use default opensuse kernel for tests The kvmsmall kernel lacks important modules like the dummy network device which TEST-17-UDEV requires very early on. --- mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a1a47783507..95c5c194a42 100644 --- a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf +++ b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf @@ -43,7 +43,7 @@ Packages= group(root) gzip iputils - kernel-kvmsmall + kernel-default kmod libasan8 libkmod2 From 6e40124efb77e404c844a0a7587bf45cfff64556 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Tue, 23 Apr 2024 16:36:15 +0100 Subject: [PATCH 03/10] mkosi: use generic ubuntu kernel for udev and nvme tests TEST-17-UDEV expects to find scsi_debug and TEST-84-STORAGETM expects to find nvmet-tcp. This isn't ideal as it adds firmware, microcode and other drivers to the initramfs, but there's no linux-modules-extra virtual package to just include the extra modules. --- mkosi.images/system/mkosi.conf.d/10-ubuntu/mkosi.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkosi.images/system/mkosi.conf.d/10-ubuntu/mkosi.conf b/mkosi.images/system/mkosi.conf.d/10-ubuntu/mkosi.conf index 957d00e4297..86f9736ed97 100644 --- a/mkosi.images/system/mkosi.conf.d/10-ubuntu/mkosi.conf +++ b/mkosi.images/system/mkosi.conf.d/10-ubuntu/mkosi.conf @@ -5,6 +5,6 @@ Distribution=ubuntu [Content] Packages= - linux-image-virtual + linux-image-generic linux-tools-common linux-tools-virtual From 8ccba68cb543643ef3eb64fb0c22f39d4cf28c0e Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Tue, 23 Apr 2024 22:30:24 +0100 Subject: [PATCH 04/10] TEST-17-UDEV: Skip credentials test if service not loaded It does not appear to exist on OpenSUSE yet. --- test/units/testsuite-17.credentials.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/units/testsuite-17.credentials.sh b/test/units/testsuite-17.credentials.sh index cbdc57037e1..42d3883c396 100755 --- a/test/units/testsuite-17.credentials.sh +++ b/test/units/testsuite-17.credentials.sh @@ -4,6 +4,11 @@ set -eux set -o pipefail +if [[ $(systemctl is-enabled systemd-udev-load-credentials.service) == not-found ]]; then + echo "Missing systemd-udev-load-credentials.service" >>/skipped + exit 0 +fi + at_exit() { rm -f /run/credstore/udev.* rm -f /run/udev/udev.conf.d/* From 60d064d3fdfc21d9209d81ed8b29fe0d90891ebf Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Thu, 25 Apr 2024 12:18:57 +0100 Subject: [PATCH 05/10] TEST-19-CGROUP: Skip on opensuse OpenSUSE images seem to be unhappy with either how they are built or what they are being asked to do. The listed device-mapper failure is just one of the strange errors, I have also seen it fail to propagate cgroup properties into new cgroups that were previously guaranteed to exist. --- test/units/testsuite-19.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/units/testsuite-19.sh b/test/units/testsuite-19.sh index 9c2a033aa98..60c53cd80de 100755 --- a/test/units/testsuite-19.sh +++ b/test/units/testsuite-19.sh @@ -3,6 +3,14 @@ set -eux set -o pipefail +. /etc/os-release +# FIXME: This test fails on opensuse with the following error and others: +# Apr 25 10:24:04 H (cat)[910]: device-mapper: create ioctl on ... failed: Device or resource busy +if [[ "$ID" =~ "opensuse" ]]; then + echo "Skipping due to known unexpected behaviour in OpenSUSE kernels" >>/skipped + exit 77 +fi + # shellcheck source=test/units/test-control.sh . "$(dirname "$0")"/test-control.sh From dcb17e3295dfce1a9a9f4fb648c4750c05d3c46d Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Wed, 24 Apr 2024 12:16:37 +0100 Subject: [PATCH 06/10] TEST-25-IMPORT: Skip if importctl not installed machinectl import-* was split out into importctl which is a separately configurable component to machinectl and might not always be available. --- test/units/testsuite-25.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/units/testsuite-25.sh b/test/units/testsuite-25.sh index b298c506e12..24b02cedcf6 100755 --- a/test/units/testsuite-25.sh +++ b/test/units/testsuite-25.sh @@ -3,6 +3,11 @@ set -eux set -o pipefail +if ! command -v importctl >/dev/null; then + echo "importctl is not available to be chain-loaded from machinectl, skipping" >>/skipped + exit 77 +fi + export SYSTEMD_PAGER=cat dd if=/dev/urandom of=/var/tmp/testimage.raw bs=$((1024*1024+7)) count=5 From 4114b723f965ed19c8cf56be130a91f6abc99ea9 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Wed, 24 Apr 2024 14:44:27 +0100 Subject: [PATCH 07/10] TEST-26-SYSTEMCTL: Create /etc/init.d if needed OpenSUSE doesn't disable sysv compat but also may not have anything in /etc/init.d. --- test/units/testsuite-26.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/units/testsuite-26.sh b/test/units/testsuite-26.sh index 6734aee654f..27aa98edb78 100755 --- a/test/units/testsuite-26.sh +++ b/test/units/testsuite-26.sh @@ -386,6 +386,10 @@ if [[ -x /usr/lib/systemd/system-generators/systemd-sysv-generator ]]; then # at runtime, so let's just support the two most common paths for now. [[ -d /etc/rc.d/init.d ]] && SYSVINIT_PATH="/etc/rc.d/init.d" || SYSVINIT_PATH="/etc/init.d" + # OpenSUSE leaves sysvinit-path enabled, which means systemd-sysv-generator is built + # but may not create the directory if there's no services that use it. + mkdir -p "$SYSVINIT_PATH" + # invalid dependency cat >"${SYSVINIT_PATH:?}/issue-24990" <<\EOF #!/bin/bash From 90eee2cf0f998e875da4e664b322c1d9431c218a Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Fri, 26 Apr 2024 12:54:34 +0100 Subject: [PATCH 08/10] TEST-36-NUMAPOLICY: Bump PID1 strace time to 3 seconds CI can be slow and only waiting 1 second makes it flaky there. --- test/units/testsuite-36.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/units/testsuite-36.sh b/test/units/testsuite-36.sh index 12bf1393e4b..02ca88f80df 100755 --- a/test/units/testsuite-36.sh +++ b/test/units/testsuite-36.sh @@ -29,7 +29,7 @@ testUnitFile="/run/systemd/system/$testUnit" testUnitNUMAConf="$testUnitFile.d/numa.conf" # Sleep constants (we should probably figure out something better but nothing comes to mind) -sleepAfterStart=1 +sleepAfterStart=3 # Journal cursor for easier navigation journalCursorFile="jounalCursorFile" From 337d246fafc74867bf5566e0e5a09bb5b310d099 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Sat, 24 Feb 2024 18:13:59 +0000 Subject: [PATCH 09/10] TEST-81-GENERATORS: Clean /proc/cmdline of unusual mounts --- test/units/testsuite-81.fstab-generator.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/units/testsuite-81.fstab-generator.sh b/test/units/testsuite-81.fstab-generator.sh index 4a69245ed87..e50419a0ecc 100755 --- a/test/units/testsuite-81.fstab-generator.sh +++ b/test/units/testsuite-81.fstab-generator.sh @@ -13,6 +13,7 @@ OUT_DIR="$(mktemp -d /tmp/fstab-generator.XXX)" FSTAB="$(mktemp)" at_exit() { + mountpoint -q /proc/cmdline && umount /proc/cmdline rm -fr "${OUT_DIR:?}" "${FSTAB:?}" } @@ -294,6 +295,12 @@ check_fstab_mount_units() { done } +# Drop usrhash on the command-line so fstab-generator doesn't add a /dev/mapper +# mount for /usr, add a root= to emulate a more typical environment, +# and remove any systemd.mount-extra= +sed -r -e 's/usrhash=[^[:space:]+]/root=\/dev\/sda2/' -e 's/systemd.mount-extra=[^[:space:]+]//g' /proc/cmdline >/tmp/cmdline.tmp +mount --bind /tmp/cmdline.tmp /proc/cmdline + : "fstab-generator: regular" printf "%s\n" "${FSTAB_GENERAL_ROOT[@]}" >"$FSTAB" cat "$FSTAB" From 66fb77a8bf5661b71e14f39b15983f8a0545aaba Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Thu, 18 Apr 2024 10:39:00 +0100 Subject: [PATCH 10/10] test/meson.build: Add some runnable integration tests --- test/meson.build | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/meson.build b/test/meson.build index f8e40fa0065..235c68ae29c 100644 --- a/test/meson.build +++ b/test/meson.build @@ -338,9 +338,38 @@ integration_test_wrapper = find_program('integration-test-wrapper.py') integration_tests = { '01': 'TEST-01-BASIC', '02': 'TEST-02-UNITTESTS', + '03': 'TEST-03-JOBS', + '05': 'TEST-05-RLIMITS', + '16': 'TEST-16-EXTEND-TIMEOUT', + '17': 'TEST-17-UDEV', # Can be flaky when overloaded if timeout abort test is slow + '19': 'TEST-19-CGROUP', + '25': 'TEST-25-IMPORT', + '26': 'TEST-26-SYSTEMCTL', '29': 'TEST-29-PORTABLE', + '30': 'TEST-30-ONCLOCKCHANGE', + '32': 'TEST-32-OOMPOLICY', + '34': 'TEST-34-DYNAMICUSERMIGRATE', + '36': 'TEST-36-NUMAPOLICY', + '38': 'TEST-38-FREEZER', '43': 'TEST-43-PRIVATEUSER-UNPRIV', + '44': 'TEST-44-LOG-NAMESPACE', + '45': 'TEST-45-TIMEDATE', '50': 'TEST-50-DISSECT', + # Can be flaky when overloaded if daemon-reload is too slow to be rate-limited + '59': 'TEST-59-RELOADING-RESTART', + '60': 'TEST-60-MOUNT-RATELIMIT', + '62': 'TEST-62-RESTRICT-IFACES', + '63': 'TEST-63-PATH', + '66': 'TEST-66-DEVICE-ISOLATION', + '67': 'TEST-67-INTEGRITY', + '68': 'TEST-68-PROPAGATE-EXIT-STATUS', + '72': 'TEST-72-SYSUPDATE', + '76': 'TEST-76-SYSCTL', + '78': 'TEST-78-SIGQUEUE', + '79': 'TEST-79-MEMPRESS', + '80': 'TEST-80-NOTIFYACCESS', + '81': 'TEST-81-GENERATORS', + '84': 'TEST-84-STORAGETM', } foreach test_number, dirname : integration_tests test_params = {