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