]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
test(ISCSI): fix the watchdog loop
authorHarald Hoyer <harald@redhat.com>
Mon, 26 Apr 2021 09:06:41 +0000 (11:06 +0200)
committerHarald Hoyer <harald@hoyer.xyz>
Mon, 26 Apr 2021 12:13:41 +0000 (14:13 +0200)
Test for `pidof tgtd` and not the shell background jobs.

test/TEST-30-ISCSI/server-init.sh
test/TEST-30-ISCSI/test.sh
test/TEST-35-ISCSI-MULTI/server-init.sh
test/TEST-35-ISCSI-MULTI/test.sh

index 420ad618229cdf3451a4670dede24cb88c33a4f9..9c00d7d9bdfb54c9230791ff7b7f9434b849023f 100755 (executable)
@@ -44,11 +44,14 @@ tgtadm --lld iscsi --mode target --op bind --tid 1 -I 192.168.50.101
 tgtadm --lld iscsi --mode target --op bind --tid 2 -I 192.168.51.101
 tgtadm --lld iscsi --mode target --op bind --tid 3 -I 192.168.50.101
 
+echo "Serving iSCSI"
+
 # Wait forever for the VM to die
-while :; do
-    echo "Serving iSCSI"
-    [ -n "$(jobs -rp)" ] && echo > /dev/watchdog
-    sleep 10
+while pidof tgtd > /dev/null; do
+    : > /dev/watchdog
+    dmesg -c
+    sleep 1
 done
+dmesg -c
 mount -n -o remount,ro /
 poweroff -f
index 39269c5b0dfba9bbb5414871791c4a2c77350cb0..d72d67e9494db0774c19e9dc4cbf87e40e6e4bfc 100755 (executable)
@@ -244,7 +244,7 @@ test_setup() {
         inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
             dmesg mkdir cp ping \
             modprobe tcpdump setsid \
-            /etc/services sleep mount chmod
+            /etc/services sleep mount chmod pidof
         inst_multiple tgtd tgtadm
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f ${_terminfodir}/l/linux ] && break
index 420335c9c3a77012045461cd280a631addba2a7d..436ee9b8dda309cf7e17794ce974d809accda78a 100755 (executable)
@@ -78,9 +78,11 @@ tgtadm --lld iscsi --mode target --op bind --tid 3 -I 192.168.50.101
 
 # Wait forever for the VM to die
 echo "Serving iSCSI"
-while :; do
-    [ -n "$(jobs -rp)" ] && echo > /dev/watchdog
-    sleep 10
+while pidof tgtd > /dev/null; do
+    : > /dev/watchdog
+    dmesg -c
+    sleep 1
 done
+dmesg -c
 mount -n -o remount,ro /
 poweroff -f
index 1dee2eedf179454fd9b5b407da9d66283af4ea7d..f3f213a1b60f732a171c8fdc37eb468ea492127e 100755 (executable)
@@ -248,7 +248,7 @@ test_setup() {
         inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
             dmesg mkdir cp ping \
             modprobe tcpdump setsid \
-            /etc/services sleep mount chmod
+            /etc/services sleep mount chmod pidof
         inst_multiple tgtd tgtadm
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f ${_terminfodir}/l/linux ] && break