From 6ef1262d6348be28434316657ccbf0958d1043dd Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Fri, 26 Aug 2022 15:53:46 +0200 Subject: [PATCH 1/5] test: bump the reboot timeout to 60 seconds As the reboot might take a bit on oversaturated hypervisors (spotted in Ubuntu CI). --- test/test-shutdown.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-shutdown.py b/test/test-shutdown.py index 060a0e651a..52207a4656 100755 --- a/test/test-shutdown.py +++ b/test/test-shutdown.py @@ -74,7 +74,7 @@ def run(args): logger.info("waiting for reboot") - console.expect('H login: ', 30) + console.expect('H login: ', 60) console.sendline('root') console.expect('bash.*# ', 10) From 10d7ed12c9aedae3055218452de452800c3ea39d Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Fri, 26 Aug 2022 15:59:37 +0200 Subject: [PATCH 2/5] test: use a unique machine name for each nspawn test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit to avoid scope clashing in case some previous test crashed and/or didn't clean up properly. Currently all test machines are called `root`, since the name is automagically derived from the container path (in this case `/var/tmp/systemd-test.XXXXXX/root`). E.g. (from Ubuntu CI): ``` [23:10:12] --x-- Running TEST-71-HOSTNAME --x-- make: Entering directory '/tmp/autopkgtest.5LjnBV/build.0mE/systemd/test/TEST-71-HOSTNAME' + make -C TEST-71-HOSTNAME setup run TEST-71-HOSTNAME SETUP: test hostnamed Reusing existing cached image /tmp/autopkgtest.5LjnBV/build.0mE/systemd/test/TEST-71-HOSTNAME/../default.img → /tmp/autopkgtest.5LjnBV/build.0mE/systemd/test/default.img '/var/tmp/systemd-test.1yy2SS/default.img' -> '/tmp/autopkgtest.5LjnBV/build.0mE/systemd/test/default.img' I: Masking supporting services '/var/tmp/systemd-test.1yy2SS/root/etc/systemd/system/systemd-hwdb-update.service' -> '/dev/null' '/var/tmp/systemd-test.1yy2SS/root/etc/systemd/system/systemd-journal-catalog-update.service' -> '/dev/null' '/var/tmp/systemd-test.1yy2SS/root/etc/systemd/system/systemd-networkd.service' -> '/dev/null' '/var/tmp/systemd-test.1yy2SS/root/etc/systemd/system/systemd-networkd.socket' -> '/dev/null' '/var/tmp/systemd-test.1yy2SS/root/etc/systemd/system/systemd-resolved.service' -> '/dev/null' TEST-71-HOSTNAME RUN: test hostnamed + env --unset=UNIFIED_CGROUP_HIERARCHY --unset=SYSTEMD_NSPAWN_UNIFIED_HIERARCHY timeout --foreground 1200 /bin/systemd-nspawn --register=no --kill-signal=SIGKILL --directory=/var/tmp/systemd-test.1yy2SS/root --setenv=SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/testsuite-71.units:/usr/lib/systemd/tests/testdata/units: /lib/systemd/systemd systemd.unit=testsuite.target systemd.wants=testsuite-71.service systemd.wants=end.service Spawning container root on /var/tmp/systemd-test.1yy2SS/root. Press ^] three times within 1s to kill container. Failed to allocate scope: Unit root.scope already exists. E: nspawn failed with exit code 1 ``` --- test/test-functions | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test-functions b/test/test-functions index 359eb90314..1c0441e7c5 100644 --- a/test/test-functions +++ b/test/test-functions @@ -538,6 +538,7 @@ run_nspawn() { "--kill-signal=SIGKILL" "--directory=${1:?}" "--setenv=SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/testsuite-$2.units:/usr/lib/systemd/tests/testdata/units:" + "--machine=TEST-$TESTID" ) local kernel_params=( "$PATH_TO_INIT" From 3c833171bd8360a43ab82ee80826113b278647e0 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Fri, 26 Aug 2022 16:17:11 +0200 Subject: [PATCH 3/5] test: respect the global $QEMU_TIMEOUT CIs set QEMU and nspawn timeouts by themselves which reflect their needs and possibilities, so let's respect that value, instead of using one pre-set value which might or might not work for all of them. Both Ubuntu CI and CentOS CI set these values themselves. --- test/TEST-08-ISSUE-2730/test.sh | 1 - test/TEST-09-ISSUE-2691/test.sh | 2 -- test/TEST-11-ISSUE-3166/test.sh | 2 -- test/TEST-17-UDEV/test.sh | 1 - test/TEST-18-FAILUREACTION/test.sh | 2 -- test/TEST-19-DELEGATE/test.sh | 1 - test/TEST-31-DEVICE-ENUMERATION/test.sh | 1 - test/TEST-50-DISSECT/test.sh | 1 - test/TEST-64-UDEV-STORAGE/test.sh | 1 - test/TEST-67-INTEGRITY/test.sh | 1 - 10 files changed, 13 deletions(-) diff --git a/test/TEST-08-ISSUE-2730/test.sh b/test/TEST-08-ISSUE-2730/test.sh index 83557f22ec..0564314a86 100755 --- a/test/TEST-08-ISSUE-2730/test.sh +++ b/test/TEST-08-ISSUE-2730/test.sh @@ -9,7 +9,6 @@ TEST_NO_NSPAWN=1 # shellcheck source=test/test-functions . "${TEST_BASE_DIR:?}/test-functions" -QEMU_TIMEOUT=300 TEST_FORCE_NEWIMAGE=1 do_test "$@" diff --git a/test/TEST-09-ISSUE-2691/test.sh b/test/TEST-09-ISSUE-2691/test.sh index 1c995f4801..3fc243cc55 100755 --- a/test/TEST-09-ISSUE-2691/test.sh +++ b/test/TEST-09-ISSUE-2691/test.sh @@ -8,6 +8,4 @@ TEST_NO_NSPAWN=1 # shellcheck source=test/test-functions . "${TEST_BASE_DIR:?}/test-functions" -QEMU_TIMEOUT=300 - do_test "$@" diff --git a/test/TEST-11-ISSUE-3166/test.sh b/test/TEST-11-ISSUE-3166/test.sh index 9adccc10b2..12dabd704d 100755 --- a/test/TEST-11-ISSUE-3166/test.sh +++ b/test/TEST-11-ISSUE-3166/test.sh @@ -8,6 +8,4 @@ TEST_NO_NSPAWN=1 # shellcheck source=test/test-functions . "${TEST_BASE_DIR:?}/test-functions" -QEMU_TIMEOUT=300 - do_test "$@" diff --git a/test/TEST-17-UDEV/test.sh b/test/TEST-17-UDEV/test.sh index 9d91eee204..6b8f08fc32 100755 --- a/test/TEST-17-UDEV/test.sh +++ b/test/TEST-17-UDEV/test.sh @@ -8,6 +8,5 @@ TEST_NO_NSPAWN=1 # shellcheck source=test/test-functions . "${TEST_BASE_DIR:?}/test-functions" -QEMU_TIMEOUT=800 do_test "$@" diff --git a/test/TEST-18-FAILUREACTION/test.sh b/test/TEST-18-FAILUREACTION/test.sh index a72365d0ec..c11aab1ea9 100755 --- a/test/TEST-18-FAILUREACTION/test.sh +++ b/test/TEST-18-FAILUREACTION/test.sh @@ -7,6 +7,4 @@ TEST_DESCRIPTION="FailureAction= operation" # shellcheck source=test/test-functions . "${TEST_BASE_DIR:?}/test-functions" -QEMU_TIMEOUT=600 - do_test "$@" diff --git a/test/TEST-19-DELEGATE/test.sh b/test/TEST-19-DELEGATE/test.sh index 5623708312..1b50ac3ae7 100755 --- a/test/TEST-19-DELEGATE/test.sh +++ b/test/TEST-19-DELEGATE/test.sh @@ -8,7 +8,6 @@ TEST_NO_NSPAWN=1 # shellcheck source=test/test-functions . "${TEST_BASE_DIR:?}/test-functions" -QEMU_TIMEOUT=600 UNIFIED_CGROUP_HIERARCHY=yes do_test "$@" diff --git a/test/TEST-31-DEVICE-ENUMERATION/test.sh b/test/TEST-31-DEVICE-ENUMERATION/test.sh index 01dd8744a7..107fa7de44 100755 --- a/test/TEST-31-DEVICE-ENUMERATION/test.sh +++ b/test/TEST-31-DEVICE-ENUMERATION/test.sh @@ -8,6 +8,5 @@ TEST_NO_NSPAWN=1 # shellcheck source=test/test-functions . "${TEST_BASE_DIR:?}/test-functions" -QEMU_TIMEOUT=300 do_test "$@" diff --git a/test/TEST-50-DISSECT/test.sh b/test/TEST-50-DISSECT/test.sh index c6cd42d0a7..0940382d52 100755 --- a/test/TEST-50-DISSECT/test.sh +++ b/test/TEST-50-DISSECT/test.sh @@ -12,7 +12,6 @@ TEST_INSTALL_VERITY_MINIMAL=1 # shellcheck source=test/test-functions . "${TEST_BASE_DIR:?}/test-functions" -QEMU_TIMEOUT=1200 command -v mksquashfs >/dev/null 2>&1 || exit 0 command -v veritysetup >/dev/null 2>&1 || exit 0 diff --git a/test/TEST-64-UDEV-STORAGE/test.sh b/test/TEST-64-UDEV-STORAGE/test.sh index 80c60f19f7..07b5df1d82 100755 --- a/test/TEST-64-UDEV-STORAGE/test.sh +++ b/test/TEST-64-UDEV-STORAGE/test.sh @@ -12,7 +12,6 @@ TEST_DESCRIPTION="systemd-udev storage tests" TEST_NO_NSPAWN=1 # Save only journals of failing test cases by default (to conserve space) TEST_SAVE_JOURNAL="${TEST_SAVE_JOURNAL:-fail}" -QEMU_TIMEOUT="${QEMU_TIMEOUT:-600}" # shellcheck source=test/test-functions . "${TEST_BASE_DIR:?}/test-functions" diff --git a/test/TEST-67-INTEGRITY/test.sh b/test/TEST-67-INTEGRITY/test.sh index b3bc1441ab..1ec2d4bf7f 100755 --- a/test/TEST-67-INTEGRITY/test.sh +++ b/test/TEST-67-INTEGRITY/test.sh @@ -5,7 +5,6 @@ set -e TEST_DESCRIPTION="dm-integrity test" TEST_NO_NSPAWN=1 -QEMU_TIMEOUT=600 # shellcheck source=test/test-functions . "${TEST_BASE_DIR:?}/test-functions" From cd15f7f6d1c32dd70fc146cc3cded5f1604dfa8b Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Fri, 26 Aug 2022 16:19:42 +0200 Subject: [PATCH 4/5] test: set the default QEMU and nspawn timeouts to 30 minutes Set both timeouts to some reasonable values instead of just `infinity` to provide some form of a safe-net in case the test goes haywire and the environment didn't set the timeouts itself (like our CIs do). --- test/test-functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test-functions b/test/test-functions index 1c0441e7c5..473587fe9f 100644 --- a/test/test-functions +++ b/test/test-functions @@ -24,8 +24,8 @@ source "$os_release" [[ "$ID" = "arch" || " $ID_LIKE " = *" arch "* ]] && LOOKS_LIKE_ARCH=yes || LOOKS_LIKE_ARCH="" [[ " $ID_LIKE " = *" suse "* ]] && LOOKS_LIKE_SUSE=yes || LOOKS_LIKE_SUSE="" KERNEL_VER="${KERNEL_VER-$(uname -r)}" -QEMU_TIMEOUT="${QEMU_TIMEOUT:-infinity}" -NSPAWN_TIMEOUT="${NSPAWN_TIMEOUT:-infinity}" +QEMU_TIMEOUT="${QEMU_TIMEOUT:-1800}" +NSPAWN_TIMEOUT="${NSPAWN_TIMEOUT:-1800}" TIMED_OUT= # will be 1 after run_* if *_TIMEOUT is set and test timed out [[ "$LOOKS_LIKE_SUSE" ]] && FSTYPE="${FSTYPE:-btrfs}" || FSTYPE="${FSTYPE:-ext4}" UNIFIED_CGROUP_HIERARCHY="${UNIFIED_CGROUP_HIERARCHY:-default}" From 12ee072db571d5d3aca37fbf9b9261441ac9aeff Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Fri, 26 Aug 2022 19:18:20 +0200 Subject: [PATCH 5/5] test: make the virt detection quiet Follow-up to cde09b07dfdc132a31672693c037bfc0b5879331. --- test/test-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-functions b/test/test-functions index 473587fe9f..c8b0cef1f2 100644 --- a/test/test-functions +++ b/test/test-functions @@ -92,7 +92,7 @@ add_at_exit_handler() { # check if it's not explicitly disabled (TEST_NO_KVM) and we're not already # running under KVM. If these conditions are met, enable KVM (and possibly # nested KVM), otherwise disable it. -if get_bool "${TEST_NESTED_KVM:=}" || (! get_bool "${TEST_NO_KVM:=}" && ! systemd-detect-virt -v); then +if get_bool "${TEST_NESTED_KVM:=}" || (! get_bool "${TEST_NO_KVM:=}" && ! systemd-detect-virt -qv); then QEMU_KVM=yes else QEMU_KVM=no