Blob Blame History Raw
From 4e882b8090e82b0f0ffabfb45f0a2cd69768ef53 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 27 May 2016 10:52:28 +0200
Subject: [PATCH] use shutdown-emergency hook in testsuite to poweroff the
 machine

---
 modules.d/99base/dracut-lib.sh    | 6 +++++-
 test/TEST-01-BASIC/test.sh        | 2 +-
 test/TEST-02-SYSTEMD/test.sh      | 2 +-
 test/TEST-03-USR-MOUNT/test.sh    | 2 +-
 test/TEST-04-FULL-SYSTEMD/test.sh | 2 +-
 test/TEST-10-RAID/test.sh         | 2 +-
 test/TEST-11-LVM/test.sh          | 2 +-
 test/TEST-12-RAID-DEG/test.sh     | 2 +-
 test/TEST-13-ENC-RAID-LVM/test.sh | 2 +-
 test/TEST-14-IMSM/test.sh         | 2 +-
 test/TEST-15-BTRFSRAID/test.sh    | 2 +-
 test/TEST-16-DMSQUASH/test.sh     | 2 +-
 test/TEST-17-LVM-THIN/test.sh     | 2 +-
 test/TEST-20-NFS/test.sh          | 4 ++--
 test/TEST-30-ISCSI/test.sh        | 2 +-
 test/TEST-40-NBD/test.sh          | 4 ++--
 test/TEST-50-MULTINIC/test.sh     | 2 +-
 17 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 48fc83d..94e4614 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -457,7 +457,11 @@ die() {
 
     > /run/initramfs/.die
 
-    getargbool 0 "rd.shell=" && emergency_shell
+    if getargbool 0 "rd.shell"; then
+        emergency_shell
+    else
+        source_hook "shutdown-emergency"
+    fi
 
     if [ -n "$DRACUT_SYSTEMD" ]; then
         systemctl --no-block --force halt
diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh
index 83320e2..959ac05 100755
--- a/test/TEST-01-BASIC/test.sh
+++ b/test/TEST-01-BASIC/test.sh
@@ -89,7 +89,7 @@ test_setup() {
 	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-init.sh
 	inst_multiple poweroff shutdown
-	inst_hook emergency 000 ./hard-off.sh
+	inst_hook shutdown-emergency 000 ./hard-off.sh
 	inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
     )
     sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
diff --git a/test/TEST-02-SYSTEMD/test.sh b/test/TEST-02-SYSTEMD/test.sh
index 16f5c26..6dc6f42 100755
--- a/test/TEST-02-SYSTEMD/test.sh
+++ b/test/TEST-02-SYSTEMD/test.sh
@@ -86,7 +86,7 @@ test_setup() {
 	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-init.sh
 	inst_multiple poweroff shutdown
-	inst_hook emergency 000 ./hard-off.sh
+	inst_hook shutdown-emergency 000 ./hard-off.sh
 	inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
     )
     sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
diff --git a/test/TEST-03-USR-MOUNT/test.sh b/test/TEST-03-USR-MOUNT/test.sh
index 61063fd..0aca8cf 100755
--- a/test/TEST-03-USR-MOUNT/test.sh
+++ b/test/TEST-03-USR-MOUNT/test.sh
@@ -124,7 +124,7 @@ test_setup() {
 	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-init.sh
 	inst_multiple poweroff shutdown
-	inst_hook emergency 000 ./hard-off.sh
+	inst_hook shutdown-emergency 000 ./hard-off.sh
 	inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
     )
     sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
diff --git a/test/TEST-04-FULL-SYSTEMD/test.sh b/test/TEST-04-FULL-SYSTEMD/test.sh
index c7e08bf..884f441 100755
--- a/test/TEST-04-FULL-SYSTEMD/test.sh
+++ b/test/TEST-04-FULL-SYSTEMD/test.sh
@@ -261,7 +261,7 @@ EOF
 	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-init.sh
 	inst_multiple poweroff shutdown
-	inst_hook emergency 000 ./hard-off.sh
+	inst_hook shutdown-emergency 000 ./hard-off.sh
 	inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
     )
 
diff --git a/test/TEST-10-RAID/test.sh b/test/TEST-10-RAID/test.sh
index 523b61a..6ec77a6 100755
--- a/test/TEST-10-RAID/test.sh
+++ b/test/TEST-10-RAID/test.sh
@@ -86,7 +86,7 @@ test_setup() {
 	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-init.sh
 	inst_multiple poweroff shutdown
-	inst_hook emergency 000 ./hard-off.sh
+	inst_hook shutdown-emergency 000 ./hard-off.sh
 	inst ./cryptroot-ask.sh /sbin/cryptroot-ask
         mkdir -p $initdir/etc
         echo "testluks UUID=$ID_FS_UUID /etc/key" > $initdir/etc/crypttab
diff --git a/test/TEST-11-LVM/test.sh b/test/TEST-11-LVM/test.sh
index 34c7736..412a065 100755
--- a/test/TEST-11-LVM/test.sh
+++ b/test/TEST-11-LVM/test.sh
@@ -79,7 +79,7 @@ test_setup() {
 	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-init.sh
 	inst_multiple poweroff shutdown
-	inst_hook emergency 000 ./hard-off.sh
+	inst_hook shutdown-emergency 000 ./hard-off.sh
 	inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
     )
     sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
diff --git a/test/TEST-12-RAID-DEG/test.sh b/test/TEST-12-RAID-DEG/test.sh
index f4ec2d0..444dca6 100755
--- a/test/TEST-12-RAID-DEG/test.sh
+++ b/test/TEST-12-RAID-DEG/test.sh
@@ -129,7 +129,7 @@ test_setup() {
 	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-init.sh
 	inst_multiple poweroff shutdown
-	inst_hook emergency 000 ./hard-off.sh
+	inst_hook shutdown-emergency 000 ./hard-off.sh
 	inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
 	inst ./cryptroot-ask.sh /sbin/cryptroot-ask
         mkdir -p $initdir/etc
diff --git a/test/TEST-13-ENC-RAID-LVM/test.sh b/test/TEST-13-ENC-RAID-LVM/test.sh
index ea81697..2a814f8 100755
--- a/test/TEST-13-ENC-RAID-LVM/test.sh
+++ b/test/TEST-13-ENC-RAID-LVM/test.sh
@@ -123,7 +123,7 @@ test_setup() {
 	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-init.sh
 	inst_multiple poweroff shutdown
-	inst_hook emergency 000 ./hard-off.sh
+	inst_hook shutdown-emergency 000 ./hard-off.sh
 	inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
 	inst ./cryptroot-ask.sh /sbin/cryptroot-ask
         mkdir -p $initdir/etc
diff --git a/test/TEST-14-IMSM/test.sh b/test/TEST-14-IMSM/test.sh
index f4ea7ae..315bc5a 100755
--- a/test/TEST-14-IMSM/test.sh
+++ b/test/TEST-14-IMSM/test.sh
@@ -113,7 +113,7 @@ test_setup() {
 	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-init.sh
 	inst_multiple poweroff shutdown
-	inst_hook emergency 000 ./hard-off.sh
+	inst_hook shutdown-emergency 000 ./hard-off.sh
 	inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
     )
     sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
diff --git a/test/TEST-15-BTRFSRAID/test.sh b/test/TEST-15-BTRFSRAID/test.sh
index 5a9b6e1..8e2ea49 100755
--- a/test/TEST-15-BTRFSRAID/test.sh
+++ b/test/TEST-15-BTRFSRAID/test.sh
@@ -87,7 +87,7 @@ test_setup() {
         export initdir=$TESTDIR/overlay
 	. $basedir/dracut-init.sh
 	inst_multiple poweroff shutdown
-	inst_hook emergency 000 ./hard-off.sh
+	inst_hook shutdown-emergency 000 ./hard-off.sh
 	inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
     )
     sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
diff --git a/test/TEST-16-DMSQUASH/test.sh b/test/TEST-16-DMSQUASH/test.sh
index 53a45d6..b255492 100755
--- a/test/TEST-16-DMSQUASH/test.sh
+++ b/test/TEST-16-DMSQUASH/test.sh
@@ -43,7 +43,7 @@ test_setup() {
 	export initdir="$TESTDIR"/overlay
 	. "$basedir"/dracut-init.sh
 	inst_multiple poweroff shutdown
-	inst_hook emergency 000 ./hard-off.sh
+	inst_hook shutdown-emergency 000 ./hard-off.sh
 	inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
     )
 
diff --git a/test/TEST-17-LVM-THIN/test.sh b/test/TEST-17-LVM-THIN/test.sh
index 859d4dc..e337591 100755
--- a/test/TEST-17-LVM-THIN/test.sh
+++ b/test/TEST-17-LVM-THIN/test.sh
@@ -79,7 +79,7 @@ test_setup() {
 	export initdir=$TESTDIR/overlay
 	. $basedir/dracut-init.sh
 	inst_multiple poweroff shutdown
-	inst_hook emergency 000 ./hard-off.sh
+	inst_hook shutdown-emergency 000 ./hard-off.sh
 	inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
     )
     sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh
index ceca1f0..1dfdfc4 100755
--- a/test/TEST-20-NFS/test.sh
+++ b/test/TEST-20-NFS/test.sh
@@ -141,7 +141,7 @@ test_nfsv3() {
 
     # This test must fail: nfsroot= requires root=/dev/nfs
     client_test "NFSv3 Invalid root=dhcp nfsroot=/nfs/client" 52:54:00:12:34:04 \
-        "root=dhcp nfsroot=/nfs/client failme" 192.168.50.1 -wsize=4096 && return 1
+        "root=dhcp nfsroot=/nfs/client failme rd.debug" 192.168.50.1 -wsize=4096 && return 1
 
     client_test "NFSv3 root=dhcp DHCP path,options" \
         52:54:00:12:34:05 "root=dhcp" 192.168.50.1 wsize=4096 || return 1
@@ -334,7 +334,7 @@ test_setup() {
         . $basedir/dracut-init.sh
         mkdir $TESTDIR/overlay
         inst_multiple poweroff shutdown
-        inst_hook emergency 000 ./hard-off.sh
+        inst_hook shutdown-emergency 000 ./hard-off.sh
         inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
     )
 
diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh
index 940edb6..1c06b06 100755
--- a/test/TEST-30-ISCSI/test.sh
+++ b/test/TEST-30-ISCSI/test.sh
@@ -213,7 +213,7 @@ test_setup() {
         export initdir=$TESTDIR/overlay
         . $basedir/dracut-init.sh
         inst_multiple poweroff shutdown
-        inst_hook emergency 000 ./hard-off.sh
+        inst_hook shutdown-emergency 000 ./hard-off.sh
         inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
     )
     sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
diff --git a/test/TEST-40-NBD/test.sh b/test/TEST-40-NBD/test.sh
index 28ba6aa..2061392 100755
--- a/test/TEST-40-NBD/test.sh
+++ b/test/TEST-40-NBD/test.sh
@@ -226,7 +226,7 @@ make_encrypted_root() {
             done
         )
         inst_multiple mke2fs poweroff cp umount tune2fs
-        inst_hook emergency 000 ./hard-off.sh
+        inst_hook shutdown-emergency 000 ./hard-off.sh
         inst_hook initqueue 01 ./create-root.sh
         inst_hook initqueue/finished 01 ./finished-false.sh
         inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
@@ -362,7 +362,7 @@ test_setup() {
         export initdir=$TESTDIR/overlay
         . $basedir/dracut-init.sh
         inst_multiple poweroff shutdown
-        inst_hook emergency 000 ./hard-off.sh
+        inst_hook shutdown-emergency 000 ./hard-off.sh
         inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
         inst ./cryptroot-ask.sh /sbin/cryptroot-ask
 
diff --git a/test/TEST-50-MULTINIC/test.sh b/test/TEST-50-MULTINIC/test.sh
index 484ebee..e0bf7d2 100755
--- a/test/TEST-50-MULTINIC/test.sh
+++ b/test/TEST-50-MULTINIC/test.sh
@@ -269,7 +269,7 @@ test_setup() {
         export initdir="$TESTDIR"/overlay
         . "$basedir"/dracut-init.sh
         inst_multiple poweroff shutdown
-        inst_hook emergency 000 ./hard-off.sh
+        inst_hook shutdown-emergency 000 ./hard-off.sh
         inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
     )