Merge pull request #28801 from mrc0mmand/initrd-shutdown-test
test: introduce TEST-08-INITRD
This commit is contained in:
@@ -19,11 +19,6 @@ if systemd-detect-virt -q --container; then
|
||||
test ! -e /run/systemd/container
|
||||
cp -afv /tmp/container /run/systemd/container
|
||||
else
|
||||
# We should've created a mount under /run in initrd (see the other half of the test)
|
||||
# that should've survived the transition from initrd to the real system
|
||||
test -d /run/initrd-mount-target
|
||||
mountpoint /run/initrd-mount-target
|
||||
|
||||
# We bring the loopback netdev up only during a full setup, so it should
|
||||
# not get brought back up during reexec if we disable it beforehand
|
||||
[[ "$(ip -o link show lo)" =~ LOOPBACK,UP ]]
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
[Unit]
|
||||
Description=TEST-08-INITRD
|
||||
After=multi-user.target
|
||||
|
||||
[Service]
|
||||
ExecStartPre=rm -f /failed /testok
|
||||
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
|
||||
Type=oneshot
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
set -eux
|
||||
set -o pipefail
|
||||
|
||||
if systemd-detect-virt -qc; then
|
||||
echo >&2 "This test can't run in a container"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# We should've created a mount under /run in initrd (see the other half of the test)
|
||||
# that should've survived the transition from initrd to the real system
|
||||
test -d /run/initrd-mount-target
|
||||
mountpoint /run/initrd-mount-target
|
||||
[[ -e /run/initrd-mount-target/hello-world ]]
|
||||
|
||||
# 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/
|
||||
|
||||
touch /testok
|
||||
Reference in New Issue
Block a user