From a8bc9400a8e415d184c1f6f91155b7190405cc78 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 28 Apr 2024 17:10:56 +0200 Subject: [PATCH 01/32] mkosi: Remove more files from Arch minimal image --- .../minimal-base/mkosi.conf.d/10-arch.conf | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/mkosi.images/minimal-base/mkosi.conf.d/10-arch.conf b/mkosi.images/minimal-base/mkosi.conf.d/10-arch.conf index 25edbc526a..30e8fda59e 100644 --- a/mkosi.images/minimal-base/mkosi.conf.d/10-arch.conf +++ b/mkosi.images/minimal-base/mkosi.conf.d/10-arch.conf @@ -8,3 +8,29 @@ Packages= inetutils iproute openbsd-netcat + +RemoveFiles= + # Arch Linux doesn't split their gcc-libs package so we manually remove + # unneeded stuff here to make sure it doesn't end up in the image. + /usr/lib/libgfortran.so* + /usr/lib/libgo.so* + /usr/lib/libgomp.so* + /usr/lib/libgphobos.so* + /usr/lib/libobjc.so* + /usr/lib/libasan.so* + /usr/lib/libtsan.so* + /usr/lib/liblsan.so* + /usr/lib/libubsan.so* + /usr/lib/libstdc++.so* + /usr/lib/libgdruntime.so* + + # Remove all files that are only required for development. + /usr/lib/*.a + /usr/include/* + + /usr/share/i18n/* + /usr/share/hwdata/* + /usr/share/iana-etc/* + /usr/share/locale/* + /usr/share/terminfo/* + /usr/share/zoneinfo/* From 48e0399bee7aae16393447874ab6430fe42ab242 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 28 Apr 2024 17:18:32 +0200 Subject: [PATCH 02/32] mkosi: Install minimal-base to /usr/share/testsuite-13-container-template Required for TEST-13-NSPAWN. --- 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 2f5c8af25b..b9b7437f1f 100644 --- a/mkosi.images/system/mkosi.conf +++ b/mkosi.images/system/mkosi.conf @@ -19,6 +19,7 @@ ExtraTrees= %O/minimal-1.root-%a.raw:/usr/share/minimal_1.raw %O/minimal-1.root-%a-verity.raw:/usr/share/minimal_1.verity %O/minimal-1.root-%a-verity-sig.raw:/usr/share/minimal_1.verity.sig + %O/minimal-base:/usr/share/testsuite-13-container-template Packages= acl From e839cb1cf878e86d41cadc49302483aca444fd32 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 28 Apr 2024 19:09:44 +0200 Subject: [PATCH 03/32] mkosi: Use symlinks instead of bind mounts for Arch With bind mounts, the directories we bind mount to get recorded as the meson source and build directories. This means meson will complain if we later try to run meson install -C /work/build in the virtual machine or container. If we use symlinks, the directories we symlink to will be recorded as the meson source and build directories, which means meson install -C /work/build will work when executed after booting the VM or container. I tried to do the same for debian as well but the debian package tooling changes directory into the build directory and then does meson setup .. which is completely broken when switching to a symlink. --- .../system/mkosi.conf.d/10-arch/mkosi.build.chroot | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot b/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot index 04eeaf1e37..33a64cb1d5 100755 --- a/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot +++ b/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot @@ -10,12 +10,12 @@ if [ ! -f "pkg/$ID/PKGBUILD" ]; then exit 1 fi -# We can't configure the source or build directory so we use bind mounts instead to make sure they are in the +# We can't configure the source or build directory so we use symlinks instead to make sure they are in the # expected locations. -mount --mkdir --bind "$SRCDIR" "pkg/$ID/systemd-stable/" -mount --mkdir --bind "$BUILDDIR" "pkg/$ID/build/" +ln --symbolic "$SRCDIR" "pkg/$ID/systemd-stable" +ln --symbolic "$BUILDDIR" "pkg/$ID/build" # Because we run with --noextract we are responsible for making sure the source files appear in src/. -mount --mkdir --rbind "$PWD/pkg/$ID" "pkg/$ID/src/" +ln --symbolic . "pkg/$ID/src" # shellcheck source=/dev/null . /etc/makepkg.conf From a531931cd4d05894bfb98b99b647e58761aa8ccc Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 28 Apr 2024 19:11:50 +0200 Subject: [PATCH 04/32] mkosi: Simply remove all the debian patches instead of mounting over them The build sources are ephemeral anyways, so we can just remove the patches instead of hiding them. --- .../system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot index e4f589d6b6..e8921c2efe 100755 --- a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot +++ b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot @@ -13,9 +13,8 @@ fi # We transplant the debian/ folder from the deb package sources into the upstream sources. mount --mkdir --bind "$SRCDIR/pkg/$ID/debian" "$SRCDIR"/debian -# We hide the patches/ directory by mounting an empty directory on top so they don't get applied. -TMP=$(mktemp -d) -mount --bind "$TMP" "$SRCDIR"/debian/patches +# We remove the patches so they don't get applied. +rm -rf "$SRCDIR"/debian/patches/* # While the build directory can be specified through DH_OPTIONS, the default one is hardcoded everywhere so # we have to use that. Because it is architecture dependent, we query it using dpkg-architecture first. From 06489e8332b3fc060cadd67f38e3811ef48cd6c6 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 28 Apr 2024 19:28:37 +0200 Subject: [PATCH 05/32] mkosi: Make sure our extra kernel command line overrides the config one --- test/integration-test-wrapper.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/integration-test-wrapper.py b/test/integration-test-wrapper.py index 1e003342df..d30fa30c87 100755 --- a/test/integration-test-wrapper.py +++ b/test/integration-test-wrapper.py @@ -93,7 +93,6 @@ 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 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', ] @@ -109,6 +108,16 @@ def main(): 'systemd.hostname=H', f"SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/testsuite-{args.test_number}.units:/usr/lib/systemd/tests/testdata/units:", f"systemd.unit={test_unit}", + *( + [ + "systemd.mask=serial-getty@.service", + "systemd.show_status=no", + "systemd.crash_shell=0", + "systemd.crash_reboot", + ] + if not sys.stderr.isatty() + else [] + ), ]), '--credential', f"journal.storage={'persistent' if sys.stderr.isatty() else 'runtime'}" , *args.mkosi_args, From 989d46df8b346db4468019d318a1f587a4b6d900 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 28 Apr 2024 20:28:59 +0200 Subject: [PATCH 06/32] mkosi: Install locales on debian/ubuntu Required for TEST-73-LOCALE. --- 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 7d58cf676b..1f3284787e 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 @@ -51,6 +51,7 @@ Packages= libcap-ng-utils libtss2-rc0 libtss2-tcti-device0 + locales man-db netcat-openbsd openssh-client From d99deaaaea0f0ef1ad0714e666c93f247aa48d49 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 28 Apr 2024 20:46:14 +0200 Subject: [PATCH 07/32] mkosi: Disable --runtime-scratch=no for tests Breaks TEST-83-BTRFS if enabled. --- 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 d30fa30c87..e8b14926f4 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', + '--runtime-scratch=no', '--append', '--kernel-command-line-extra', ' '.join([ From e911a335ed8a1d07cf062a4e1b2f0e877654e6cf Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 28 Apr 2024 22:51:41 +0200 Subject: [PATCH 08/32] mkosi: Mask systemd-networkd-wait-online when --runtime-network=none Otherwise it will wait forever waiting for an interface to appear. See https://github.com/systemd/systemd/issues/29388. --- 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 e8b14926f4..bb19a6d10d 100755 --- a/test/integration-test-wrapper.py +++ b/test/integration-test-wrapper.py @@ -109,6 +109,7 @@ def main(): 'systemd.hostname=H', f"SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/testsuite-{args.test_number}.units:/usr/lib/systemd/tests/testdata/units:", f"systemd.unit={test_unit}", + 'systemd.mask=systemd-networkd-wait-online.service', *( [ "systemd.mask=serial-getty@.service", From 334e7073294e410455e62b970d763ad76b928b0a Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Thu, 18 Apr 2024 09:05:01 +0100 Subject: [PATCH 09/32] mkosi: Add curl package for journal 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 b9b7437f1f..7ae4c90bb0 100644 --- a/mkosi.images/system/mkosi.conf +++ b/mkosi.images/system/mkosi.conf @@ -26,6 +26,7 @@ Packages= attr bash-completion coreutils + curl diffutils dnsmasq dosfstools From 27f166c52369e994524a6f79cf157e92e45c0433 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Mon, 29 Apr 2024 10:47:25 +0200 Subject: [PATCH 10/32] mkosi: Use systemd.crash_action=poweroff in integration tests Some integration tests expect to be able to reboot so switch to using the new systemd.crash_action=poweroff instead. --- test/integration-test-wrapper.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/integration-test-wrapper.py b/test/integration-test-wrapper.py index bb19a6d10d..0d3e4abde7 100755 --- a/test/integration-test-wrapper.py +++ b/test/integration-test-wrapper.py @@ -93,8 +93,6 @@ 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)}", - # 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 [] @@ -115,7 +113,7 @@ def main(): "systemd.mask=serial-getty@.service", "systemd.show_status=no", "systemd.crash_shell=0", - "systemd.crash_reboot", + "systemd.crash_action=poweroff", ] if not sys.stderr.isatty() else [] @@ -124,7 +122,6 @@ def main(): '--credential', f"journal.storage={'persistent' if sys.stderr.isatty() else 'runtime'}" , *args.mkosi_args, 'qemu', - *(['-no-reboot'] if not sys.stderr.isatty() else []) ] result = subprocess.run(cmd) From 695ebbaf7fbbcfb9128e2f135efe057fb8558cd9 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Mon, 29 Apr 2024 13:40:43 +0200 Subject: [PATCH 11/32] mkosi: Override /sbin/init in minimal-base Required for TEST-13-NSPAWN. --- mkosi.images/minimal-base/mkosi.postinst | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 mkosi.images/minimal-base/mkosi.postinst diff --git a/mkosi.images/minimal-base/mkosi.postinst b/mkosi.images/minimal-base/mkosi.postinst new file mode 100755 index 0000000000..c76fb0a011 --- /dev/null +++ b/mkosi.images/minimal-base/mkosi.postinst @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +# We don't use mkosi.extra because /usr/sbin could be a symlink and cp doesn't handle that properly until +# coreutils 9.5 or newer. +cat >"$BUILDROOT/sbin/init" < Date: Mon, 29 Apr 2024 16:27:31 +0200 Subject: [PATCH 12/32] mkosi: Install tpm2-tools in system image Required for TEST-70-TPM2. --- mkosi.images/system/mkosi.conf.d/10-arch/mkosi.conf | 1 + mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf | 1 + mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf | 1 + mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf | 1 + 4 files changed, 4 insertions(+) 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 5b08224ebb..f8a5f9a3e7 100644 --- a/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.conf +++ b/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.conf @@ -41,6 +41,7 @@ Packages= sbsigntools shadow squashfs-tools + tpm2-tools tpm2-tss vim diff --git a/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf b/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf index 524ffa0de5..d35fabefd4 100644 --- a/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf +++ b/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf @@ -50,6 +50,7 @@ Packages= rpm-build rpmautospec squashfs-tools + tpm2-tools util-linux vim-common 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 1f3284787e..385a8ff04d 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 @@ -63,6 +63,7 @@ Packages= quota sbsigntool squashfs-tools + tpm2-tools tzdata xxd 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 95c5c194a4..d7248bec24 100644 --- a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf +++ b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf @@ -63,6 +63,7 @@ Packages= shadow squashfs timezone + tpm2.0-tools user(bin) user(daemon) user(games) From 3c9a807ac86be7c6ba4adf8d7ae2085fd25a0800 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Tue, 30 Apr 2024 13:38:31 +0200 Subject: [PATCH 13/32] mkosi: Install more locales on CentOS/Fedora Required for TEST-73-LOCALE. --- mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf b/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf index d35fabefd4..ba8c33f350 100644 --- a/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf +++ b/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf @@ -26,6 +26,8 @@ Packages= dhcp-server dnf git-core + glibc-langpack-de + glibc-langpack-en gnutls integritysetup iproute From f991c3871b0c2a954574b9fde64b905555324223 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Tue, 30 Apr 2024 16:09:49 +0200 Subject: [PATCH 14/32] mkosi: Fix %__check_files eval in opensuse build script Make sure the correct buildroot gets expanded instead of the default opensuse build root location. We also remove debug files from the unpackaged files list as they're handled separately by rpm. --- .../system/mkosi.conf.d/10-opensuse/mkosi.build.chroot | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot index 8a2df74236..83b5a7e666 100755 --- a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot +++ b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot @@ -63,7 +63,7 @@ build() { --define "vendor openSUSE" \ --define "version_override $VERSION" \ --define "release_override $RELEASE" \ - --define "__check_files sh -c '$(rpm --eval %__check_files) | tee /tmp/unpackaged-files'" \ + --define "__check_files sh -c '$(rpm --define "_topdir /var/tmp" --eval %__check_files) | tee /tmp/unpackaged-files'" \ --define "build_cflags $(rpm --eval %build_cflags) $EXTRA_CFLAGS" \ --define "meson_build %{shrink:%{__meson} compile -C %{_vpath_builddir} -j %{_smp_build_ncpus} %{nil}}" \ --define "meson_install %{shrink:DESTDIR=%{buildroot} %{__meson} install -C %{_vpath_builddir} --no-rebuild --quiet %{nil}}" \ @@ -86,7 +86,7 @@ if ! build; then # warnings. rm systemd.lang - cat /tmp/unpackaged-files >>"pkg/$ID/files.systemd" + grep -v ".debug" /tmp/unpackaged-files >>"pkg/$ID/files.systemd" build --noprep --nocheck fi From 37029ce7691050e59aeeb0700045b2d495604111 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Sat, 17 Feb 2024 21:42:45 +0000 Subject: [PATCH 15/32] TEST-35-LOGIN: Handle multiple lock messages per sleep If 3 lock messages get sent when going to sleep then we can falsely assume we have woken up if we only assume we have at least two so checking we have more than we did before sleeping addresses that issue. --- test/units/testsuite-35.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/units/testsuite-35.sh b/test/units/testsuite-35.sh index e9af67f358..4ca312d6ba 100755 --- a/test/units/testsuite-35.sh +++ b/test/units/testsuite-35.sh @@ -524,11 +524,15 @@ EOF # least one session, so minimum of 2 "Lock" signals must have been sent. timeout 35 bash -c "while [[ \"\$(journalctl -b -u systemd-logind.service --since=$ts | grep -c 'Sent message type=signal .* member=Lock')\" -lt 1 ]]; do sleep 1; done" + # We need to know that a new message was sent after waking up, + # so we must track how many happened before sleeping to check we have extra. + locks="$(journalctl -b -u systemd-logind.service --since="$ts" | grep -c 'Sent message type=signal .* member=Lock')" + # Wakeup touch /dev/tty2 # Wait again - timeout 35 bash -c "while [[ \"\$(journalctl -b -u systemd-logind.service --since=$ts | grep -c 'Sent message type=signal .* member=Lock')\" -lt 2 ]]; do sleep 1; done" + timeout 35 bash -c "while [[ \"\$(journalctl -b -u systemd-logind.service --since=$ts | grep -c 'Sent message type=signal .* member=Lock')\" -lt $((locks + 1)) ]]; do sleep 1; done" if [[ "$(journalctl -b -u systemd-logind.service --since="$ts" | grep -c 'System idle. Will be locked now.')" -lt 2 ]]; then echo >&2 "System haven't entered idle state at least 2 times." From 191a31fbcf1ae074d139154f7d415afcb4061ffb Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 28 Apr 2024 20:58:01 +0200 Subject: [PATCH 16/32] TEST-83-BTRFS: Skip if root filesystem is not btrfs --- test/units/testsuite-83.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/units/testsuite-83.sh b/test/units/testsuite-83.sh index a722c79d4e..4f10ae7468 100755 --- a/test/units/testsuite-83.sh +++ b/test/units/testsuite-83.sh @@ -3,6 +3,13 @@ set -eux set -o pipefail +FSTYPE="$(stat --file-system --format "%T" /)" + +if [[ "$FSTYPE" != "btrfs" ]]; then + echo "Root filesystem is $FSTYPE instead of btrfs, skipping" + exit 77 +fi + TEST_BTRFS_OFFSET=/usr/lib/systemd/tests/unit-tests/manual/test-btrfs-physical-offset SWAPFILE=/var/tmp/swapfile From b81ece59c453e4f20f4d08c7f642b59ea24fcd0b Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 28 Apr 2024 22:52:59 +0200 Subject: [PATCH 17/32] TEST-04-JOURNAL: Make LogFilterPatterns= tests more robust Let's use oneshot services as we don't need long running services for the tests we're doing. Let's also increase the sleeps a little as the current values weren't sufficient when running the test locally on my machine with mkosi. --- .../delegated-cgroup-filtering.service | 2 +- test/testsuite-04.units/logs-filtering.service | 3 ++- test/units/delegated_cgroup_filtering_payload.sh | 11 ++++------- .../units/delegated_cgroup_filtering_payload_child.sh | 9 +++------ test/units/testsuite-04.LogFilterPatterns.sh | 10 +++------- 5 files changed, 13 insertions(+), 22 deletions(-) diff --git a/test/testsuite-04.units/delegated-cgroup-filtering.service b/test/testsuite-04.units/delegated-cgroup-filtering.service index 2c4201a27b..a12b12ac4a 100644 --- a/test/testsuite-04.units/delegated-cgroup-filtering.service +++ b/test/testsuite-04.units/delegated-cgroup-filtering.service @@ -2,7 +2,7 @@ Description=Test service for delegated logs filtering [Service] -Type=simple +Type=oneshot ExecStart=/usr/lib/systemd/tests/testdata/units/delegated_cgroup_filtering_payload.sh Delegate=yes SyslogLevel=notice diff --git a/test/testsuite-04.units/logs-filtering.service b/test/testsuite-04.units/logs-filtering.service index 6e2af9a2a1..a5aba1859c 100644 --- a/test/testsuite-04.units/logs-filtering.service +++ b/test/testsuite-04.units/logs-filtering.service @@ -2,5 +2,6 @@ Description=Log filtering unit [Service] -ExecStart=sh -c 'while true; do echo "Logging from the service, and ~more~ foo bar"; sleep .25; done' +Type=oneshot +ExecStart=sh -c 'echo "Logging from the service, and ~more~ foo bar" && sleep 2' SyslogLevel=notice diff --git a/test/units/delegated_cgroup_filtering_payload.sh b/test/units/delegated_cgroup_filtering_payload.sh index 50d01a5d4a..7ad486bcad 100755 --- a/test/units/delegated_cgroup_filtering_payload.sh +++ b/test/units/delegated_cgroup_filtering_payload.sh @@ -2,11 +2,8 @@ # SPDX-License-Identifier: LGPL-2.1-or-later mkdir /sys/fs/cgroup/system.slice/delegated-cgroup-filtering.service/the_child -/bin/sh /usr/lib/systemd/tests/testdata/units/delegated_cgroup_filtering_payload_child.sh & +/bin/sh /usr/lib/systemd/tests/testdata/units/delegated_cgroup_filtering_payload_child.sh -while true -do - echo "parent_process: hello, world!" - echo "parent_process: hello, people!" - sleep .15 -done +echo "parent_process: hello, world!" +echo "parent_process: hello, people!" +sleep .15 diff --git a/test/units/delegated_cgroup_filtering_payload_child.sh b/test/units/delegated_cgroup_filtering_payload_child.sh index b5635b58e5..94f0d3acef 100755 --- a/test/units/delegated_cgroup_filtering_payload_child.sh +++ b/test/units/delegated_cgroup_filtering_payload_child.sh @@ -3,9 +3,6 @@ echo $$ >/sys/fs/cgroup/system.slice/delegated-cgroup-filtering.service/the_child/cgroup.procs -while true -do - echo "child_process: hello, world!" - echo "child_process: hello, people!" - sleep .15 -done +echo "child_process: hello, world!" +echo "child_process: hello, people!" +sleep .15 diff --git a/test/units/testsuite-04.LogFilterPatterns.sh b/test/units/testsuite-04.LogFilterPatterns.sh index d5d610fe02..dfa9652ee2 100755 --- a/test/units/testsuite-04.LogFilterPatterns.sh +++ b/test/units/testsuite-04.LogFilterPatterns.sh @@ -18,16 +18,12 @@ add_logs_filtering_override() { run_service_and_fetch_logs() { local unit="${1:?}" - local start end + local start start="$(date '+%Y-%m-%d %T.%6N')" - systemctl restart "$unit" - sleep .5 + systemctl start "$unit" journalctl --sync - end="$(date '+%Y-%m-%d %T.%6N')" - - journalctl -q -u "$unit" -S "$start" -U "$end" -p notice - systemctl stop "$unit" + journalctl -q -u "$unit" -S "$start" -p notice } if cgroupfs_supports_user_xattrs; then From 047d5b6a321bfa325f42b1f516aaec0909141a06 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Tue, 13 Feb 2024 12:50:58 +0000 Subject: [PATCH 18/32] TEST-13-NSPAWN: move container template to /usr/share Having directories in / causes problems for make-root-on-boot images --- test/TEST-13-NSPAWN/test.sh | 2 +- test/units/util.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/TEST-13-NSPAWN/test.sh b/test/TEST-13-NSPAWN/test.sh index 6dfb527718..915f2db86b 100755 --- a/test/TEST-13-NSPAWN/test.sh +++ b/test/TEST-13-NSPAWN/test.sh @@ -11,7 +11,7 @@ TEST_NO_NSPAWN=1 test_append_files() { local workspace="${1:?}" - local container="$workspace/testsuite-13-container-template" + local container="$workspace/usr/share/testsuite-13-container-template" # For virtual wlan interface. instmods mac80211_hwsim diff --git a/test/units/util.sh b/test/units/util.sh index 8eea263135..619cb8ebbf 100755 --- a/test/units/util.sh +++ b/test/units/util.sh @@ -156,13 +156,13 @@ coverage_create_nspawn_dropin() { create_dummy_container() { local root="${1:?}" - if [[ ! -d /testsuite-13-container-template ]]; then + if [[ ! -d /usr/share/testsuite-13-container-template ]]; then echo >&2 "Missing container template, probably not running in TEST-13-NSPAWN?" exit 1 fi mkdir -p "$root" - cp -a /testsuite-13-container-template/* "$root" + cp -a /usr/share/testsuite-13-container-template/* "$root" coverage_create_nspawn_dropin "$root" } From 3630f5aaf8d6235dc1aae8a32712158a4c8ddfc7 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Tue, 13 Feb 2024 12:48:26 +0000 Subject: [PATCH 19/32] TEST-13-NSPAWN: move disk images to /var/tmp /tmp may not be large enough to contain disk images and will result in strange errors when it runs out of space. --- test/TEST-13-NSPAWN/test.sh | 2 ++ test/test-functions | 6 ++-- test/units/testsuite-13.machinectl.sh | 40 +++++++++++------------ test/units/testsuite-13.nspawn-oci.sh | 4 +-- test/units/testsuite-13.nspawn.sh | 6 ++-- test/units/testsuite-13.nss-mymachines.sh | 3 +- 6 files changed, 31 insertions(+), 30 deletions(-) diff --git a/test/TEST-13-NSPAWN/test.sh b/test/TEST-13-NSPAWN/test.sh index 915f2db86b..744e793ac2 100755 --- a/test/TEST-13-NSPAWN/test.sh +++ b/test/TEST-13-NSPAWN/test.sh @@ -5,6 +5,8 @@ set -e TEST_DESCRIPTION="systemd-nspawn tests" IMAGE_NAME="nspawn" TEST_NO_NSPAWN=1 +IMAGE_ADDITIONAL_ROOT_SIZE=500 +TEST_FORCE_NEWIMAGE=1 # shellcheck source=test/test-functions . "${TEST_BASE_DIR:?}/test-functions" diff --git a/test/test-functions b/test/test-functions index 59242b3569..10ea6ef03a 100644 --- a/test/test-functions +++ b/test/test-functions @@ -476,8 +476,7 @@ run_qemu() { local CONSOLE=ttyS0 - # Reset the boot counter, if present - rm -f "${initdir:?}/var/tmp/.systemd_reboot_count" + find "${initdir:?}/var/tmp" -mindepth 1 -delete rm -f "$initdir"/{testok,failed,skipped} # make sure the initdir is not mounted to avoid concurrent access cleanup_initdir @@ -651,8 +650,7 @@ run_qemu() { # success), or 1 if nspawn is not available. run_nspawn() { [[ -d /run/systemd/system ]] || return 1 - # Reset the boot counter, if present - rm -f "${initdir:?}/var/tmp/.systemd_reboot_count" + find "${initdir:?}/var/tmp" -mindepth 1 -delete rm -f "${initdir:?}"/{testok,failed,skipped} local nspawn_cmd=() diff --git a/test/units/testsuite-13.machinectl.sh b/test/units/testsuite-13.machinectl.sh index c3bfde2768..6e2ad165bd 100755 --- a/test/units/testsuite-13.machinectl.sh +++ b/test/units/testsuite-13.machinectl.sh @@ -23,9 +23,9 @@ trap at_exit EXIT systemctl service-log-level systemd-machined debug systemctl service-log-level systemd-importd debug -# Mount tmpfs over /var/lib/machines to not pollute the image +# Mount temporary directory over /var/lib/machines to not pollute the image mkdir -p /var/lib/machines -mount -t tmpfs tmpfs /var/lib/machines +mount --bind "$(mktemp --tmpdir=/var/tmp -d)" /var/lib/machines # Create a couple of containers we can refer to in tests for i in {0..4}; do @@ -154,37 +154,37 @@ test ! -d /var/lib/machines/.hidden1 # Prepare a simple raw container mkdir -p /tmp/mnt -dd if=/dev/zero of=/tmp/container.raw bs=1M count=64 -mkfs.ext4 /tmp/container.raw -mount -o loop /tmp/container.raw /tmp/mnt +dd if=/dev/zero of=/var/tmp/container.raw bs=1M count=256 +mkfs.ext4 /var/tmp/container.raw +mount -o loop /var/tmp/container.raw /tmp/mnt cp -r /var/lib/machines/container1/* /tmp/mnt umount /tmp/mnt # Try to import it, run it, export it, and re-import it -machinectl import-raw /tmp/container.raw container-raw +machinectl import-raw /var/tmp/container.raw container-raw [[ "$(machinectl show-image --property=Type --value container-raw)" == "raw" ]] machinectl start container-raw -machinectl export-raw container-raw /tmp/container-export.raw -machinectl import-raw /tmp/container-export.raw container-raw-reimport +machinectl export-raw container-raw /var/tmp/container-export.raw +machinectl import-raw /var/tmp/container-export.raw container-raw-reimport [[ "$(machinectl show-image --property=Type --value container-raw-reimport)" == "raw" ]] -rm -f /tmp/container{,-export}.raw +rm -f /var/tmp/container{,-export}.raw # Prepare a simple tar.gz container -tar -pczf /tmp/container.tar.gz -C /var/lib/machines/container1 . +tar -pczf /var/tmp/container.tar.gz -C /var/lib/machines/container1 . # Try to import it, run it, export it, and re-import it -machinectl import-tar /tmp/container.tar.gz container-tar -[[ "$(machinectl show-image --property=Type --value container-tar)" == "directory" ]] +machinectl import-tar /var/tmp/container.tar.gz container-tar +[[ "$(machinectl show-image --property=Type --value container-tar)" =~ directory|subvolume ]] machinectl start container-tar -machinectl export-tar container-tar /tmp/container-export.tar.gz -machinectl import-tar /tmp/container-export.tar.gz container-tar-reimport -[[ "$(machinectl show-image --property=Type --value container-tar-reimport)" == "directory" ]] -rm -f /tmp/container{,-export}.tar.gz +machinectl export-tar container-tar /var/tmp/container-export.tar.gz +machinectl import-tar /var/tmp/container-export.tar.gz container-tar-reimport +[[ "$(machinectl show-image --property=Type --value container-tar-reimport)" =~ directory|subvolume ]] +rm -f /var/tmp/container{,-export}.tar.gz # Try to import a container directory & run it -cp -r /var/lib/machines/container1 /tmp/container.dir -machinectl import-fs /tmp/container.dir container-dir -[[ "$(machinectl show-image --property=Type --value container-dir)" == "directory" ]] +cp -r /var/lib/machines/container1 /var/tmp/container.dir +machinectl import-fs /var/tmp/container.dir container-dir +[[ "$(machinectl show-image --property=Type --value container-dir)" =~ directory|subvolume ]] machinectl start container-dir -rm -fr /tmp/container.dir +rm -fr /var/tmp/container.dir timeout 10 bash -c "until machinectl clean --all; do sleep .5; done" diff --git a/test/units/testsuite-13.nspawn-oci.sh b/test/units/testsuite-13.nspawn-oci.sh index 8fa0bc4290..b8a76fa172 100755 --- a/test/units/testsuite-13.nspawn-oci.sh +++ b/test/units/testsuite-13.nspawn-oci.sh @@ -23,9 +23,9 @@ at_exit() { trap at_exit EXIT -# Mount tmpfs over /var/lib/machines to not pollute the image +# Mount temporary directory over /var/lib/machines to not pollute the image mkdir -p /var/lib/machines -mount -t tmpfs tmpfs /var/lib/machines +mount --bind "$(mktemp --tmpdir=/var/tmp -d)" /var/lib/machines # Setup a couple of dirs/devices for the OCI containers DEV="$(mktemp -u /dev/oci-dev-XXX)" diff --git a/test/units/testsuite-13.nspawn.sh b/test/units/testsuite-13.nspawn.sh index 5b67cf8c7e..026ed23fcd 100755 --- a/test/units/testsuite-13.nspawn.sh +++ b/test/units/testsuite-13.nspawn.sh @@ -71,9 +71,9 @@ if unshare -U bash -c :; then IS_USERNS_SUPPORTED=yes fi -# Mount tmpfs over /var/lib/machines to not pollute the image +# Mount temporary directory over /var/lib/machines to not pollute the image mkdir -p /var/lib/machines -mount -t tmpfs tmpfs /var/lib/machines +mount --bind "$(mktemp --tmpdir=/var/tmp -d)" /var/lib/machines testcase_sanity() { local template root image uuid tmpdir @@ -83,7 +83,7 @@ testcase_sanity() { create_dummy_container "$template" # Create a simple image from the just created container template image="$(mktemp /var/lib/machines/testsuite-13.image-XXX.img)" - dd if=/dev/zero of="$image" bs=1M count=64 + dd if=/dev/zero of="$image" bs=1M count=256 mkfs.ext4 "$image" mkdir -p /mnt mount -o loop "$image" /mnt diff --git a/test/units/testsuite-13.nss-mymachines.sh b/test/units/testsuite-13.nss-mymachines.sh index 931b93f953..817431b449 100755 --- a/test/units/testsuite-13.nss-mymachines.sh +++ b/test/units/testsuite-13.nss-mymachines.sh @@ -17,8 +17,9 @@ at_exit() { trap at_exit EXIT +# Mount temporary directory over /var/lib/machines to not pollute the image mkdir -p /var/lib/machines -mount -t tmpfs tmpfs /var/lib/machines +mount --bind "$(mktemp --tmpdir=/var/tmp -d)" /var/lib/machines # Create a bunch of containers that: # 1) Have no IP addresses assigned From 409c8a8ee0fc915dd5f1b72312b1b9ca16c3d812 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Mon, 29 Apr 2024 13:22:13 +0200 Subject: [PATCH 20/32] TEST-13-NSPAWN: Skip on virtiofs The rootfs only has 64K UIDs available when booting with virtiofs, whereas the nspawn tests want to use user namespace which require more than 64K UIDs. --- test/units/testsuite-13.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/units/testsuite-13.sh b/test/units/testsuite-13.sh index 9c2a033aa9..dd7f274631 100755 --- a/test/units/testsuite-13.sh +++ b/test/units/testsuite-13.sh @@ -3,6 +3,13 @@ set -eux set -o pipefail +FSTYPE="$(stat --file-system --format "%T" /)" + +if [[ "$FSTYPE" == "fuseblk" ]]; then + echo "Root filesystem is virtiofs, skipping" + exit 77 +fi + # shellcheck source=test/units/test-control.sh . "$(dirname "$0")"/test-control.sh From 8c89620e806da60afe18ca788eb61176ed78c0c5 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Mon, 29 Apr 2024 14:28:32 +0200 Subject: [PATCH 21/32] TEST-09-REBOOT: Make journalctl grep pattern more specific We might be rotating because we reached limits, which is perfectly fine, so don't fail if that happens. --- test/units/testsuite-09.journal.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/units/testsuite-09.journal.sh b/test/units/testsuite-09.journal.sh index 136d905ab9..5248d70d84 100755 --- a/test/units/testsuite-09.journal.sh +++ b/test/units/testsuite-09.journal.sh @@ -84,7 +84,7 @@ verify_seqnum() { journalctl --system --header - (! journalctl --system -q -o short-monotonic -u systemd-journald.service --grep 'rotating') + (! journalctl --system -q -o short-monotonic -u systemd-journald.service --grep 'Journal file uses a different sequence number ID, rotating') set +x previous_seqnum=0 From b03c2d51b22efce526d008793bd628c9dc7d82b3 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Mon, 29 Apr 2024 15:57:49 +0200 Subject: [PATCH 22/32] TEST-18-FAILUREACTION: Exit with 123 on success mkosi expects the virtual machine/container to exit with exit status 123 on success so let's make sure that's the case. --- test/units/testsuite-18.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/units/testsuite-18.sh b/test/units/testsuite-18.sh index 44b792f003..364c20d863 100755 --- a/test/units/testsuite-18.sh +++ b/test/units/testsuite-18.sh @@ -11,7 +11,7 @@ if ! test -f /firstphase ; then systemd-run --wait -p SuccessAction=reboot true else echo OK >/testok - systemd-run --wait -p FailureAction=poweroff false + systemd-run --wait -p FailureAction=exit -p FailureActionExitStatus=123 false fi sleep infinity From e1f17dc6417f02045b905c94f8d3c4441b9c3410 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Mon, 29 Apr 2024 16:06:54 +0200 Subject: [PATCH 23/32] TEST-35-LOGIN: Exclude manager entry in testcase_sanity_check() Otherwise we try to kill the wrong session. --- test/units/testsuite-35.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/units/testsuite-35.sh b/test/units/testsuite-35.sh index 4ca312d6ba..0f4b770de3 100755 --- a/test/units/testsuite-35.sh +++ b/test/units/testsuite-35.sh @@ -390,7 +390,7 @@ testcase_sanity_check() { # We're not in the same session scope, so in this case we need to specify # the session ID explicitly - session=$(loginctl --no-legend | awk '$3 == "logind-test-user" { print $1; exit; }') + session=$(loginctl --no-legend | grep -v manager | awk '$3 == "logind-test-user" { print $1; exit; }') loginctl kill-session --signal=SIGCONT "$session" # FIXME(?) #loginctl kill-session --signal=SIGCONT --kill-whom=leader "$session" From e290b45dfafd9faf8d717b7565465b1abb8313f4 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Mon, 29 Apr 2024 16:28:21 +0200 Subject: [PATCH 24/32] TEST-82-SOFTREBOOT: Exit with exit status 123 Required to make mkosi consider the test successful. --- test/units/testsuite-82.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/units/testsuite-82.sh b/test/units/testsuite-82.sh index 7436145598..ea96f05b38 100755 --- a/test/units/testsuite-82.sh +++ b/test/units/testsuite-82.sh @@ -251,4 +251,4 @@ fi systemd-analyze log-level info touch /testok -systemctl --no-block poweroff +systemctl --no-block exit 123 From b676bbbfc691a0664687322aba2c7b9af932abe8 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Tue, 30 Apr 2024 14:01:53 +0200 Subject: [PATCH 25/32] TEST-46-HOMED: Check for sshd pam snippet in /usr/lib/pam.d as well opensuse ships pam snippets in /usr/lib/pam.d. --- test/units/testsuite-46.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/test/units/testsuite-46.sh b/test/units/testsuite-46.sh index d9ba83aa82..7d84b0d04d 100755 --- a/test/units/testsuite-46.sh +++ b/test/units/testsuite-46.sh @@ -511,7 +511,11 @@ if command -v ssh &>/dev/null && command -v sshd &>/dev/null && ! [[ -v ASAN_OPT rm -f /tmp/homed.id_ecdsa /run/systemd/system/mysshserver{@.service,.socket} systemctl daemon-reload homectl remove homedsshtest - mv /etc/pam.d/sshd.bak /etc/pam.d/sshd + for dir in /etc /usr/lib; do + if [[ -f "$dir/pam.d/sshd.bak" ]]; then + mv "$dir/pam.d/sshd.bak" "$dir/pam.d/sshd" + fi + done } trap at_exit EXIT @@ -538,8 +542,10 @@ if command -v ssh &>/dev/null && command -v sshd &>/dev/null && ! [[ -v ASAN_OPT # are aware of distros use mkdir -p /usr/share/empty.sshd /var/empty /var/empty/sshd /run/sshd - mv /etc/pam.d/sshd /etc/pam.d/sshd.bak - cat >/etc/pam.d/sshd <"$dir/pam.d/sshd" </etc/ssh/sshd_config < Date: Tue, 30 Apr 2024 14:47:48 +0200 Subject: [PATCH 26/32] TEST-71-HOSTNAME: Ignore error from reset-failed On OpenSUSE the systemd-hostnamed does not fail and is unloaded which causes reset-failed to fail. So let's ignore any errors from reset-failed to make the test more robust. --- test/units/testsuite-71.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/units/testsuite-71.sh b/test/units/testsuite-71.sh index 813a676c92..dc3f587ea3 100755 --- a/test/units/testsuite-71.sh +++ b/test/units/testsuite-71.sh @@ -63,7 +63,8 @@ get_chassis() ( stop_hostnamed() { systemctl stop systemd-hostnamed.service - systemctl reset-failed systemd-hostnamed # reset trigger limit + # Reset trigger limit. This might fail if the unit was unloaded already, so ignore any errors. + systemctl reset-failed systemd-hostnamed || : } testcase_chassis() { From db07533f74d265329f44f4ea5983e9b3765c3c17 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Tue, 30 Apr 2024 16:14:54 +0200 Subject: [PATCH 27/32] Revert "TEST-25-IMPORT: Skip if importctl not installed" This reverts commit dcb17e3295dfce1a9a9f4fb648c4750c05d3c46d. importctl is now correctly installed on opensuse, so no need for this workaround anymore. --- test/units/testsuite-25.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/test/units/testsuite-25.sh b/test/units/testsuite-25.sh index 24b02cedcf..b298c506e1 100755 --- a/test/units/testsuite-25.sh +++ b/test/units/testsuite-25.sh @@ -3,11 +3,6 @@ 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 b8afa595832db3f553640b35b808c364cc240086 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Tue, 30 Apr 2024 16:12:35 +0200 Subject: [PATCH 28/32] test: Drop /usr overlay workaround /usr is not erofs anymore in the mkosi images so let's drop the workaround where we mount a writable tmpfs on top of /usr. --- test/units/testsuite-15.sh | 4 ---- test/units/testsuite-26.sh | 6 ------ test/units/testsuite-60.sh | 4 ---- test/units/testsuite-73.sh | 4 ---- test/units/util.sh | 16 ---------------- 5 files changed, 34 deletions(-) diff --git a/test/units/testsuite-15.sh b/test/units/testsuite-15.sh index 204fa99219..7143a1597a 100755 --- a/test/units/testsuite-15.sh +++ b/test/units/testsuite-15.sh @@ -8,10 +8,6 @@ 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 - clear_unit() { local unit_name="${1:?}" local base suffix diff --git a/test/units/testsuite-26.sh b/test/units/testsuite-26.sh index 27aa98edb7..61b0ffd812 100755 --- a/test/units/testsuite-26.sh +++ b/test/units/testsuite-26.sh @@ -12,16 +12,10 @@ at_exit() { rm -fvr "/usr/lib/systemd/system/$UNIT_NAME" "/etc/systemd/system/$UNIT_NAME.d" "+4" fi - maybe_umount_usr_overlay - rm -f /etc/init.d/issue-24990 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 - # Create a simple unit file for testing # Note: the service file is created under /usr on purpose to test # the 'revert' verb as well diff --git a/test/units/testsuite-60.sh b/test/units/testsuite-60.sh index c777de8526..e800a7a12c 100755 --- a/test/units/testsuite-60.sh +++ b/test/units/testsuite-60.sh @@ -6,10 +6,6 @@ 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 - teardown_test_dependencies() ( set +eux diff --git a/test/units/testsuite-73.sh b/test/units/testsuite-73.sh index 59f84f20ab..df5af4ba87 100755 --- a/test/units/testsuite-73.sh +++ b/test/units/testsuite-73.sh @@ -9,10 +9,6 @@ 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 - enable_debug() { mkdir -p /run/systemd/system/systemd-localed.service.d cat >>/run/systemd/system/systemd-localed.service.d/override.conf < Date: Tue, 30 Apr 2024 19:06:00 +0200 Subject: [PATCH 29/32] test: Make journal storage configurable per test and make persistent for TEST-09-JOURNAL Also fix a bug in the logic since it's 'volatile' and not 'runtime'. --- test/TEST-09-REBOOT/meson.build | 5 +++++ test/integration-test-wrapper.py | 3 ++- test/meson.build | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 test/TEST-09-REBOOT/meson.build diff --git a/test/TEST-09-REBOOT/meson.build b/test/TEST-09-REBOOT/meson.build new file mode 100644 index 0000000000..30a5a10707 --- /dev/null +++ b/test/TEST-09-REBOOT/meson.build @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +test_params = test_params + { + 'storage': 'persistent', +} diff --git a/test/integration-test-wrapper.py b/test/integration-test-wrapper.py index 0d3e4abde7..1954d0fec0 100755 --- a/test/integration-test-wrapper.py +++ b/test/integration-test-wrapper.py @@ -47,6 +47,7 @@ def main(): parser.add_argument('--meson-build-dir', required=True, type=Path) parser.add_argument('--test-name', required=True) parser.add_argument('--test-number', required=True) + parser.add_argument('--storage', required=True) parser.add_argument('mkosi_args', nargs="*") args = parser.parse_args() @@ -119,7 +120,7 @@ def main(): else [] ), ]), - '--credential', f"journal.storage={'persistent' if sys.stderr.isatty() else 'runtime'}" , + '--credential', f"journal.storage={'persistent' if sys.stderr.isatty() else args.storage}" , *args.mkosi_args, 'qemu', ] diff --git a/test/meson.build b/test/meson.build index 235c68ae29..289f564e1e 100644 --- a/test/meson.build +++ b/test/meson.build @@ -375,6 +375,7 @@ foreach test_number, dirname : integration_tests test_params = { 'mkosi_args' : [], 'timeout' : 600, + 'storage': 'volatile', } # TODO: This fs.exists call isn't included in rebuild logic @@ -389,6 +390,7 @@ foreach test_number, dirname : integration_tests '--meson-build-dir', meson.project_build_root(), '--test-name', dirname, '--test-number', test_number, + '--storage', test_params['storage'], '--', ] + test_params['mkosi_args'] From 51273281cd5eea06b9184396f203a95d791e6b5b Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Mon, 29 Apr 2024 16:01:57 +0200 Subject: [PATCH 30/32] test: Bump mkosi integration test timeout to 1800 seconds Same timeout as the bash framework. --- test/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/meson.build b/test/meson.build index 289f564e1e..6cb40ce343 100644 --- a/test/meson.build +++ b/test/meson.build @@ -374,7 +374,7 @@ integration_tests = { foreach test_number, dirname : integration_tests test_params = { 'mkosi_args' : [], - 'timeout' : 600, + 'timeout' : 1800, 'storage': 'volatile', } From f2018d060fb776b2cca25f6bae4b6e146be0d3fd Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Thu, 18 Apr 2024 15:31:56 +0100 Subject: [PATCH 31/32] test: Enable more mkosi integration tests --- test/meson.build | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/meson.build b/test/meson.build index 6cb40ce343..ff9e0687cd 100644 --- a/test/meson.build +++ b/test/meson.build @@ -339,16 +339,23 @@ integration_tests = { '01': 'TEST-01-BASIC', '02': 'TEST-02-UNITTESTS', '03': 'TEST-03-JOBS', + # '04': 'TEST-04-JOURNAL', # Extremely flaky '05': 'TEST-05-RLIMITS', + '09': 'TEST-09-REBOOT', + '13': 'TEST-13-NSPAWN', + '15': 'TEST-15-DROPIN', '16': 'TEST-16-EXTEND-TIMEOUT', '17': 'TEST-17-UDEV', # Can be flaky when overloaded if timeout abort test is slow + '18': 'TEST-18-FAILUREACTION', '19': 'TEST-19-CGROUP', + '22': 'TEST-22-TMPFILES', '25': 'TEST-25-IMPORT', '26': 'TEST-26-SYSTEMCTL', '29': 'TEST-29-PORTABLE', '30': 'TEST-30-ONCLOCKCHANGE', '32': 'TEST-32-OOMPOLICY', '34': 'TEST-34-DYNAMICUSERMIGRATE', + '35': 'TEST-35-LOGIN', '36': 'TEST-36-NUMAPOLICY', '38': 'TEST-38-FREEZER', '43': 'TEST-43-PRIVATEUSER-UNPRIV', @@ -360,15 +367,19 @@ integration_tests = { '60': 'TEST-60-MOUNT-RATELIMIT', '62': 'TEST-62-RESTRICT-IFACES', '63': 'TEST-63-PATH', + '65': 'TEST-65-ANALYZE', '66': 'TEST-66-DEVICE-ISOLATION', '67': 'TEST-67-INTEGRITY', '68': 'TEST-68-PROPAGATE-EXIT-STATUS', + '70': 'TEST-70-TPM2', + '71': 'TEST-71-HOSTNAME', '72': 'TEST-72-SYSUPDATE', '76': 'TEST-76-SYSCTL', '78': 'TEST-78-SIGQUEUE', '79': 'TEST-79-MEMPRESS', '80': 'TEST-80-NOTIFYACCESS', '81': 'TEST-81-GENERATORS', + '83': 'TEST-83-BTRFS', '84': 'TEST-84-STORAGETM', } foreach test_number, dirname : integration_tests From 4b1edf5cc669a0e074caae09b15db57a8fda7d3f Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Mon, 29 Apr 2024 14:29:21 +0200 Subject: [PATCH 32/32] test: Add disabled mkosi tests to meson.build Makes it easier to track which ones still need to be fixed. --- test/meson.build | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/meson.build b/test/meson.build index ff9e0687cd..7290b98f0d 100644 --- a/test/meson.build +++ b/test/meson.build @@ -341,6 +341,9 @@ integration_tests = { '03': 'TEST-03-JOBS', # '04': 'TEST-04-JOURNAL', # Extremely flaky '05': 'TEST-05-RLIMITS', + # '06': 'TEST-06-SELINUX', + # '07': 'TEST-07-PID1', + # '08': 'TEST-08-INITRD', '09': 'TEST-09-REBOOT', '13': 'TEST-13-NSPAWN', '15': 'TEST-15-DROPIN', @@ -348,11 +351,15 @@ integration_tests = { '17': 'TEST-17-UDEV', # Can be flaky when overloaded if timeout abort test is slow '18': 'TEST-18-FAILUREACTION', '19': 'TEST-19-CGROUP', + # '21': 'TEST-21-DFUZZER', '22': 'TEST-22-TMPFILES', + # '23': 'TEST-23-UNIT-FILE', + # '24': 'TEST-24-CRYPTSETUP', '25': 'TEST-25-IMPORT', '26': 'TEST-26-SYSTEMCTL', '29': 'TEST-29-PORTABLE', '30': 'TEST-30-ONCLOCKCHANGE', + # '31': 'TEST-31-DEVICE-ENUMERATION', '32': 'TEST-32-OOMPOLICY', '34': 'TEST-34-DYNAMICUSERMIGRATE', '35': 'TEST-35-LOGIN', @@ -361,12 +368,19 @@ integration_tests = { '43': 'TEST-43-PRIVATEUSER-UNPRIV', '44': 'TEST-44-LOG-NAMESPACE', '45': 'TEST-45-TIMEDATE', + # '46': 'TEST-46-HOMED', '50': 'TEST-50-DISSECT', + # '52': 'TEST-52-HONORFIRSTSHUTDOWN', + # '53': 'TEST-53-ISSUE-16347', + # '54': 'TEST-54-CREDS', + # '55': 'TEST-55-OOMD', + # '58': 'TEST-58-REPART', # 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', + # '64': 'TEST-54-UDEV-STORAGE', '65': 'TEST-65-ANALYZE', '66': 'TEST-66-DEVICE-ISOLATION', '67': 'TEST-67-INTEGRITY', @@ -374,11 +388,15 @@ integration_tests = { '70': 'TEST-70-TPM2', '71': 'TEST-71-HOSTNAME', '72': 'TEST-72-SYSUPDATE', + # '73': 'TEST-73-LOCALE', + # '74': 'TEST-74-AUX-UTILS', + # '75': 'TEST-75-RESOLVED', '76': 'TEST-76-SYSCTL', '78': 'TEST-78-SIGQUEUE', '79': 'TEST-79-MEMPRESS', '80': 'TEST-80-NOTIFYACCESS', '81': 'TEST-81-GENERATORS', + # '82': 'TEST-82-SOFTREBOOT', '83': 'TEST-83-BTRFS', '84': 'TEST-84-STORAGETM', }