64b87c
From 836ca3f47eb0b0a4c97ae704b0b9619a00dbfa87 Mon Sep 17 00:00:00 2001
64b87c
From: Harald Hoyer <harald@redhat.com>
64b87c
Date: Sat, 15 Aug 2015 13:22:44 +0200
64b87c
Subject: [PATCH] TEST-30-ISCSI: fix test to run with new iscsi
64b87c
64b87c
---
64b87c
 test/TEST-30-ISCSI/client-init.sh |  8 +++++++-
64b87c
 test/TEST-30-ISCSI/create-root.sh |  2 +-
64b87c
 test/TEST-30-ISCSI/test.sh        | 10 +++++-----
64b87c
 3 files changed, 13 insertions(+), 7 deletions(-)
64b87c
64b87c
diff --git a/test/TEST-30-ISCSI/client-init.sh b/test/TEST-30-ISCSI/client-init.sh
1755ca
index e78db274..2e422cd5 100755
64b87c
--- a/test/TEST-30-ISCSI/client-init.sh
64b87c
+++ b/test/TEST-30-ISCSI/client-init.sh
64b87c
@@ -1,14 +1,20 @@
64b87c
 #!/bin/sh
64b87c
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
64b87c
 exec >/dev/console 2>&1
64b87c
+strstr() { [ "${1##*"$2"*}" != "$1" ]; }
64b87c
+CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
64b87c
 export TERM=linux
64b87c
 export PS1='initramfs-test:\w\$ '
64b87c
 stty sane
64b87c
 echo "made it to the rootfs! Powering down."
64b87c
-while read dev fs fstype opts rest; do
64b87c
+while read dev fs fstype opts rest || [ -n "$dev" ]; do
64b87c
     [ "$fstype" != "ext3" ] && continue
64b87c
     echo "iscsi-OK $dev $fstype $opts" > /dev/sda
64b87c
     break
64b87c
 done < /proc/mounts
64b87c
 #sh -i
64b87c
+if strstr "$CMDLINE" "rd.shell"; then
64b87c
+	strstr "$(setsid --help)" "control" && CTTY="-c"
64b87c
+	setsid $CTTY sh -i
64b87c
+fi
64b87c
 poweroff -f
64b87c
diff --git a/test/TEST-30-ISCSI/create-root.sh b/test/TEST-30-ISCSI/create-root.sh
1755ca
index 2a4b920e..5f4b32a2 100755
64b87c
--- a/test/TEST-30-ISCSI/create-root.sh
64b87c
+++ b/test/TEST-30-ISCSI/create-root.sh
64b87c
@@ -5,7 +5,7 @@ for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
64b87c
 done
64b87c
 rm -f -- /etc/lvm/lvm.conf
64b87c
 udevadm control --reload
64b87c
-mkfs.ext3 -j -F /dev/sda && \
64b87c
+mkfs.ext3 -j -L singleroot -F /dev/sda && \
64b87c
 mkdir -p /sysroot && \
64b87c
 mount /dev/sda /sysroot && \
64b87c
 cp -a -t /sysroot /source/* && \
64b87c
diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh
1755ca
index be3399a3..92ddc860 100755
64b87c
--- a/test/TEST-30-ISCSI/test.sh
64b87c
+++ b/test/TEST-30-ISCSI/test.sh
64b87c
@@ -3,7 +3,7 @@ TEST_DESCRIPTION="root filesystem over iSCSI"
64b87c
 
64b87c
 KVERSION=${KVERSION-$(uname -r)}
64b87c
 
64b87c
-#DEBUGFAIL="rd.shell rd.break rd.debug loglevel=7 "
64b87c
+DEBUGFAIL="rd.shell rd.break rd.debug loglevel=7 "
64b87c
 DEBUGFAIL="loglevel=1"
64b87c
 #SERVER_DEBUG="rd.debug loglevel=7"
64b87c
 SERIAL="tcp:127.0.0.1:9999"
64b87c
@@ -48,7 +48,7 @@ run_client() {
64b87c
         -net nic,macaddr=52:54:00:12:34:00,model=e1000 \
64b87c
         -net nic,macaddr=52:54:00:12:34:01,model=e1000 \
64b87c
         -net socket,connect=127.0.0.1:12330 \
64b87c
-        -append "rw rd.auto rd.retry=20 console=ttyS0,115200n81 selinux=0 rd.debug=0 $DEBUGFAIL $*" \
64b87c
+        -append "rw rd.auto rd.retry=50 console=ttyS0,115200n81 selinux=0 rd.debug=0 $DEBUGFAIL $*" \
64b87c
         -initrd $TESTDIR/initramfs.testing
64b87c
     if ! grep -F -m 1 -q iscsi-OK $TESTDIR/client.img; then
64b87c
 	echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
64b87c
@@ -89,7 +89,7 @@ do_test_run() {
64b87c
 	       "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
64b87c
                "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
64b87c
                "rd.iscsi.initiator=$initiator" \
64b87c
-               "rd.waitnet=0 rd.retry=30" \
64b87c
+               "rd.iscsi.waitnet=0" \
64b87c
 	|| return 1
64b87c
 
64b87c
     run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \
64b87c
@@ -99,7 +99,7 @@ do_test_run() {
64b87c
 	       "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
64b87c
                "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
64b87c
                "rd.iscsi.initiator=$initiator" \
64b87c
-               "rd.waitnet=0 rd.iscsi.testroute=0 rd.retry=30" \
64b87c
+               "rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \
64b87c
 	|| return 1
64b87c
 
64b87c
     run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0 default GW" \
64b87c
@@ -109,7 +109,7 @@ do_test_run() {
64b87c
 	       "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
64b87c
                "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
64b87c
                "rd.iscsi.initiator=$initiator" \
64b87c
-               "rd.waitnet=0 rd.iscsi.testroute=0 rd.retry=30" \
64b87c
+               "rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \
64b87c
 	|| return 1
64b87c
 
64b87c
     return 0