]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
TEST-50-MULTINIC: improve interface test
authorHarald Hoyer <harald@redhat.com>
Tue, 10 Sep 2013 08:51:04 +0000 (10:51 +0200)
committerHarald Hoyer <harald@redhat.com>
Tue, 10 Sep 2013 08:51:04 +0000 (10:51 +0200)
test/TEST-50-MULTINIC/client-init.sh
test/TEST-50-MULTINIC/test.sh

index 3bf179de1bf654b88a37bea00b7f39e68632f505..f13c37903bae18e087ff646b658eb208e0698a2d 100755 (executable)
@@ -12,7 +12,10 @@ for i in /run/initramfs/net.*.did-setup; do
        i=${i%.did-setup}
        IFACES+="${i##*/net.} "
 done
-echo "OK $IFACES" > /dev/sda
+{
+    echo "OK"
+    echo "$IFACES"
+} > /dev/sda
 
 strstr "$CMDLINE" "rd.shell" && sh -i
 poweroff -f
index 7c9d544cf980ab737714d678a5309d0ddcb4ce41..add849c1e3b9927750673cb60711db979cc761a4 100755 (executable)
@@ -61,15 +61,24 @@ client_test() {
         -append "$cmdline $DEBUGFAIL rd.retry=5 ro console=ttyS0,115200n81 selinux=0 init=/sbin/init rd.debug systemd.log_target=console loglevel=7" \
         -initrd "$TESTDIR"/initramfs.testing
 
-    if [[ $? -ne 0 ]] || ! grep -F -m 1 -q OK -- "$TESTDIR"/client.img; then
+    { read OK; read IFACES; } < "$TESTDIR"/client.img
+
+    if [[ "$OK" != "OK" ]]; then
         echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
         return 1
     fi
 
+    for i in $check; do
+        if [[ " $IFACES " != *\ $i\ * ]]; then
+            echo "$i not in '$IFACES'"
+            echo "CLIENT TEST END: $test_name [FAILED - BAD IF]"
+            return 1
+        fi
+    done
 
-    for i in $check ; do
-        echo $i
-        if ! grep -F -m 1 -q $i -- "$TESTDIR"/client.img; then
+    for i in $IFACES; do
+        if [[ " $check " != *\ $i\ * ]]; then
+            echo "$i in '$IFACES', but should not be"
             echo "CLIENT TEST END: $test_name [FAILED - BAD IF]"
             return 1
         fi
@@ -99,6 +108,11 @@ test_client() {
         "root=nfs:192.168.50.1:/nfs/client BOOTIF=52-54-00-12-34-00" \
         "ens3" || return 1
 
+    client_test "MULTINIC root=nfs BOOTIF= ip=ens4:dhcp" \
+        00 01 02 \
+        "root=nfs:192.168.50.1:/nfs/client BOOTIF=52-54-00-12-34-00 ip=ens4:dhcp" \
+        "ens3 ens4" || return 1
+
     # PXE Style BOOTIF= with dhcp root-path
     client_test "MULTINIC root=dhcp BOOTIF=" \
         00 01 02 \