test: Rename "shutdown initrd" to "exitrd"

This commit is contained in:
Daan De Meyer 2024-05-15 08:48:46 +02:00
parent 7379849ce0
commit deaa4fb41b
2 changed files with 16 additions and 16 deletions

View file

@ -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() {

View file

@ -25,6 +25,6 @@ mountpoint /run/initrd-mount-target
# Copy the prepared shutdown initrd to its intended location. Check the respective
# test.sh file for details
mkdir -p /run/initramfs
cp -r /shutdown-initrd/* /run/initramfs/
cp -r /exitrd/* /run/initramfs/
touch /testok