From 7eb7e3ec4f5dbc13ee729557e1544527f3101187 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Wed, 14 Feb 2024 10:36:55 +0100 Subject: [PATCH 1/6] test: use btrfs by default on Arch as well --- test/test-functions | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/test-functions b/test/test-functions index abaa86792b8..3c12d054950 100644 --- a/test/test-functions +++ b/test/test-functions @@ -47,9 +47,13 @@ KERNEL_VER="${KERNEL_VER-$(uname -r)}" 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 -get_bool "$LOOKS_LIKE_SUSE" && FSTYPE="${FSTYPE:-btrfs}" || FSTYPE="${FSTYPE:-ext4}" UNIFIED_CGROUP_HIERARCHY="${UNIFIED_CGROUP_HIERARCHY:-default}" EFI_MOUNT="${EFI_MOUNT:-$(bootctl -x 2>/dev/null || echo /boot)}" +if get_bool "$LOOKS_LIKE_SUSE" || get_bool "$LOOKS_LIKE_ARCH"; then + FSTYPE="${FSTYPE:-btrfs}" +else + FSTYPE="${FSTYPE:-ext4}" +fi # Note that defining a different IMAGE_NAME in a test setup script will only result # in default.img being copied and renamed. It can then be extended by defining # a test_append_files() function. The $1 parameter will be the root directory. From adafa3b2f84ff38b0e1460ccafddd63e82019699 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Wed, 14 Feb 2024 11:24:05 +0100 Subject: [PATCH 2/6] test: always try to install the ext4 module So the tests work even if the base image filesystem is not ext4. --- test/test-functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test-functions b/test/test-functions index 3c12d054950..0b9ee0a45b4 100644 --- a/test/test-functions +++ b/test/test-functions @@ -1123,14 +1123,14 @@ install_fs_tools() { install_modules() { dinfo "Install modules" - instmods bridge dummy ipvlan macvlan vfat veth + instmods bridge dummy ext4 ipvlan macvlan vfat veth instmods loop =block instmods nls_ascii =nls instmods overlay =overlayfs instmods scsi_debug if get_bool "$LOOKS_LIKE_SUSE"; then - instmods ext4 af_packet + instmods af_packet fi } From e073c1d8ed36da84540f245cd783021b2761e4d7 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Wed, 14 Feb 2024 16:45:18 +0100 Subject: [PATCH 3/6] test: make TEST-08-INITRD slightly less annoying to debug Forward journal to console, since we won't have any journal from initrd and shutdown/exit initrd phases. Also, mention systemd.journald.max_level_console=debug that is very handy for debugging initrd shenanigans, but don't use it by default since it sends a _lot_ of stuff to the serial console, which slows down the test a lot. --- test/TEST-08-INITRD/test.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/TEST-08-INITRD/test.sh b/test/TEST-08-INITRD/test.sh index caa27f69fdf..e8dbb2c36c6 100755 --- a/test/TEST-08-INITRD/test.sh +++ b/test/TEST-08-INITRD/test.sh @@ -3,6 +3,10 @@ set -e TEST_DESCRIPTION="Test various scenarios involving transition from/to initrd" +# Note: for debugging systemd.journald.max_level_console=debug might come in handy +# as well, but it's not used here since it's _very_ noisy and slows the test +# down a lot +KERNEL_APPEND="${KERNEL_APPEND:-} systemd.journald.forward_to_console=1" TEST_NO_NSPAWN=1 # shellcheck source=test/test-functions From 1b0cf0366814f3ec103d669ed151bc5b3a144563 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Wed, 14 Feb 2024 11:48:56 +0100 Subject: [PATCH 4/6] test: use btrfs' mkswapfile on btrfs So it's created automagically with proper attributes. --- test/TEST-55-OOMD/test.sh | 4 +--- test/units/testsuite-55.sh | 9 ++++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/test/TEST-55-OOMD/test.sh b/test/TEST-55-OOMD/test.sh index 64e2360b081..9a9cdecf70e 100755 --- a/test/TEST-55-OOMD/test.sh +++ b/test/TEST-55-OOMD/test.sh @@ -15,9 +15,7 @@ test_append_files() { # Create a swap file ( image_install mkswap swapon swapoff stress - - dd if=/dev/zero of="${initdir:?}/swapfile" bs=1M count=48 - chmod 0600 "${initdir:?}/swapfile" + image_install -o btrfs mkdir -p "${initdir:?}/etc/systemd/system/init.scope.d/" cat >>"${initdir:?}/etc/systemd/system/init.scope.d/test-55-oomd.conf" < Date: Fri, 16 Feb 2024 13:49:50 +0100 Subject: [PATCH 5/6] test: don't abbreviate log messages when dumping the test journal To make debugging test fails easier. --- test/test-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-functions b/test/test-functions index 0b9ee0a45b4..6a9a1291de3 100644 --- a/test/test-functions +++ b/test/test-functions @@ -1850,7 +1850,7 @@ save_journal() { # Show messages from the testsuite-XX.service or messages with priority "warning" and higher echo " --- $source_dir ---" - "$JOURNALCTL" --no-pager --no-hostname -o short-monotonic -D "$source_dir" \ + "$JOURNALCTL" --all --no-pager --no-hostname -o short-monotonic -D "$source_dir" \ _SYSTEMD_UNIT="testsuite-${TESTID:?}.service" + SYSLOG_IDENTIFIER="testsuite-$TESTID.sh" + \ PRIORITY=4 + PRIORITY=3 + PRIORITY=2 + PRIORITY=1 + PRIORITY=0 From 7e2bf4c5ee871f797c853d8b6474d4d379dad8e2 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Fri, 16 Feb 2024 13:53:01 +0100 Subject: [PATCH 6/6] test: "modernize" TEST-55-OOMD's init --- test/TEST-55-OOMD/test.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/test/TEST-55-OOMD/test.sh b/test/TEST-55-OOMD/test.sh index 9a9cdecf70e..5e3096315ca 100755 --- a/test/TEST-55-OOMD/test.sh +++ b/test/TEST-55-OOMD/test.sh @@ -12,18 +12,17 @@ TEST_NO_NSPAWN=1 . "${TEST_BASE_DIR:?}/test-functions" test_append_files() { - # Create a swap file - ( - image_install mkswap swapon swapoff stress - image_install -o btrfs + local workspace="${1:?}" - mkdir -p "${initdir:?}/etc/systemd/system/init.scope.d/" - cat >>"${initdir:?}/etc/systemd/system/init.scope.d/test-55-oomd.conf" <"${workspace:?}/etc/systemd/system/init.scope.d/test-55-oomd.conf" <