From efeb864cb547a2cbf96dc0053a8bdb4d9190b364 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 05:50:45 +0200 Subject: Merging upstream version 256. Signed-off-by: Daniel Baumann --- test/TEST-08-INITRD/meson.build | 12 ++++++++++++ test/TEST-08-INITRD/test.sh | 40 ++++++++++++++++++++-------------------- 2 files changed, 32 insertions(+), 20 deletions(-) create mode 100644 test/TEST-08-INITRD/meson.build (limited to 'test/TEST-08-INITRD') diff --git a/test/TEST-08-INITRD/meson.build b/test/TEST-08-INITRD/meson.build new file mode 100644 index 0000000..dcbfe20 --- /dev/null +++ b/test/TEST-08-INITRD/meson.build @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +integration_tests += [ + integration_test_template + { + 'name' : fs.name(meson.current_source_dir()), + 'cmdline' : integration_test_template['cmdline'] + [ + 'rd.systemd.wants=initrd-run-mount.service', + ], + 'exit-code' : 124, + 'vm' : true, + }, +] diff --git a/test/TEST-08-INITRD/test.sh b/test/TEST-08-INITRD/test.sh index e8dbb2c..73f743c 100755 --- a/test/TEST-08-INITRD/test.sh +++ b/test/TEST-08-INITRD/test.sh @@ -14,11 +14,11 @@ TEST_NO_NSPAWN=1 test_append_files() { local workspace="${1:?}" - local sd_initrd file dir + local exitrd file dir - # Create a shutdown initrd + # Create an exitrd # - # This should provide coverage for shutdown initrd related issues, see: + # This should provide coverage for exitrd related issues, see: # - https://github.com/systemd/systemd/issues/28645 # - https://github.com/systemd/systemd/pull/28648 # - https://github.com/systemd/systemd/pull/28793 @@ -26,25 +26,25 @@ test_append_files() { # This is a bit messier than I originally anticipated, as installing our own libraries # is handled implicitly by install_systemd() which I don't want to use here, since # I need only the systemd-shutdown binary - sd_initrd="$workspace/shutdown-initrd" - mkdir -p "$sd_initrd/etc" "$sd_initrd/usr" - initdir="$sd_initrd" image_install bash /usr/lib/os-release - ln -srf "$sd_initrd/usr/lib/os-release" "$sd_initrd/etc/initrd-release" - initdir="$sd_initrd" inst_binary "$workspace/usr/lib/systemd/systemd-shutdown" "/usr/lib/systemd/systemd-shutdown" - initdir="$sd_initrd" inst_libs "$sd_initrd/usr/lib/systemd/systemd-shutdown" + exitrd="$workspace/exitrd" + mkdir -p "$exitrd/etc" "$exitrd/usr" + initdir="$exitrd" image_install bash /usr/lib/os-release + ln -srf "$exitrd/usr/lib/os-release" "$exitrd/etc/initrd-release" + initdir="$exitrd" inst_binary "$workspace/usr/lib/systemd/systemd-shutdown" "/usr/lib/systemd/systemd-shutdown" + initdir="$exitrd" inst_libs "$exitrd/usr/lib/systemd/systemd-shutdown" # We need to deal with libsystemd stuff explicitly, as we don't call install_systemd() here while read -r file; do - initdir="$sd_initrd" inst_library "$file" "${file##"$workspace"}" - initdir="$sd_initrd" inst_libs "$file" + initdir="$exitrd" inst_library "$file" "${file##"$workspace"}" + initdir="$exitrd" inst_libs "$file" done < <(find "$workspace/usr/" -name "libsystemd*.so*") # Call systemd-shutdown indirectly, so we can show a message that we can check for - # later to make sure the shutdown initrd was actually executed - cat >"$sd_initrd/shutdown" <<\EOF + # later to make sure the exitrd was actually executed + cat >"$exitrd/shutdown" <<\EOF #!/usr/bin/bash -eu -echo "Hello from shutdown initrd" +echo "Hello from exitrd" exec /usr/lib/systemd/systemd-shutdown "$@" EOF - chmod +x "$sd_initrd/shutdown" + chmod +x "$exitrd/shutdown" } check_result_qemu_hook() { @@ -65,13 +65,13 @@ check_result_qemu_hook() { # [ 6.245955] systemd-shutdown[1]: Failed to switch root to "/run/initramfs": Invalid argument if grep -qE "systemd-shutdown.+: Failed to move /run/initramfs" "$console_log" || grep -qE "systemd-shutdown.+: Failed to switch root" "$console_log"; then - derror "sd-shutdown failed to switch root in shutdown initrd" + derror "sd-shutdown failed to switch root in exitrd" return 1 fi - # Check if the shutdown initrd was executed at all - if ! grep -qE "^Hello from shutdown initrd\s*$" "$console_log"; then - derror "Missing 'hello' message from shutdown initrd" + # Check if the exitrd was executed at all + if ! grep -q "Hello from exitrd" "$console_log"; then + derror "Missing 'hello' message from exitrd" return 1 fi @@ -80,7 +80,7 @@ check_result_qemu_hook() { # Setup a one shot service in initrd that creates a dummy bind mount under /run # to check if the mount persists though the initrd transition. The "check" part -# is in the respective testsuite-08.sh script. +# is in the respective TEST-08-INITRD.sh script. # # See: https://github.com/systemd/systemd/issues/28452 run_qemu_hook() { -- cgit v1.2.3