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

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