Blame 0081-use-shutdown-emergency-hook-in-testsuite-to-poweroff.patch

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