Blame SOURCES/0299-TEST-30-ISCSI-fix-test-to-run-with-new-iscsi.patch

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