]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Exit early if startup fails
authorJouni Malinen <j@w1.fi>
Sat, 28 Sep 2013 15:19:38 +0000 (18:19 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 28 Sep 2013 15:19:38 +0000 (18:19 +0300)
There is no point trying to go through the tests if hostapd and
wpa_supplicant processes cannot be started properly.

Signed-hostap: Jouni Malinen <j@w1.fi>

tests/hwsim/run-all.sh
tests/hwsim/start-p2p-concurrent.sh
tests/hwsim/start.sh

index 68fc5359e756b10f71b4ae12e79d62f11411db3a..dbd74034a20675ed4a9ba36c335bfdf000d09baf 100755 (executable)
@@ -4,7 +4,10 @@ errors=0
 umask 0002
 
 if [ "x$1" = "xconcurrent-valgrind" ]; then
-    ./start-p2p-concurrent.sh valgrind
+    if ! ./start-p2p-concurrent.sh valgrind; then
+       echo "Could not start test environment" > logs/last-debug
+       exit 1
+    fi
     DATE=`ls -1tr logs | tail -1 | cut -f1 -d-`
     rm logs/last-debug
     for i in autogo discovery grpform; do
@@ -22,7 +25,10 @@ if [ "x$1" = "xconcurrent-valgrind" ]; then
        exit 1
     fi
 elif [ "x$1" = "xconcurrent" ]; then
-    ./start-p2p-concurrent.sh
+    if ! ./start-p2p-concurrent.sh; then
+       echo "Could not start test environment" > logs/last-debug
+       exit 1
+    fi
     DATE=`ls -1tr logs | tail -1 | cut -f1 -d-`
     rm logs/last-debug
     for i in autogo discovery grpform; do
@@ -35,7 +41,10 @@ elif [ "x$1" = "xconcurrent" ]; then
        exit 1
     fi
 elif [ "x$1" = "xvalgrind" ]; then
-    ./start.sh valgrind
+    if ! ./start.sh valgrind; then
+       echo "Could not start test environment" > logs/last-debug
+       exit 1
+    fi
     DATE=`ls -1tr logs | tail -1 | cut -f1 -d-`
     ./run-tests.py -l logs/$DATE-run -e logs/$DATE-failed || errors=1
     cat logs/$DATE-run > logs/last-debug
@@ -50,7 +59,10 @@ elif [ "x$1" = "xvalgrind" ]; then
        exit 1
     fi
 elif [ "x$1" = "xtrace" ]; then
-    ./start.sh trace
+    if ! ./start.sh trace; then
+       echo "Could not start test environment" > logs/last-debug
+       exit 1
+    fi
     DATE=`ls -1tr logs | tail -1 | cut -f1 -d-`
     sudo trace-cmd record -o logs/$DATE-trace.dat -e mac80211 -e cfg80211 su $USER -c "./run-tests.py -l logs/$DATE-run -e logs/$DATE-failed" || errors=1
     if [ -e logs/$DATE-failed ]; then
@@ -64,7 +76,10 @@ elif [ "x$1" = "xtrace" ]; then
        exit 1
     fi
 else
-    ./start.sh
+    if ! ./start.sh; then
+       echo "Could not start test environment" > logs/last-debug
+       exit 1
+    fi
     DATE=`ls -1tr logs | tail -1 | cut -f1 -d-`
     ./run-tests.py -l logs/$DATE-run -e logs/$DATE-failed || errors=1
     cat logs/$DATE-run > logs/last-debug
@@ -74,3 +89,5 @@ else
        exit 1
     fi
 fi
+
+echo "ALL-PASSED"
index c038f339f1c780f98029c9c9a6d9041c05f5b135..1d1200eab015ae091a84c0d9bebe5b3a325610c4 100755 (executable)
@@ -47,6 +47,7 @@ for i in 0 1 2; do
        fi
        if [ $j = "10" ]; then
            echo "Could not connect to /tmp/wpas-wlan$i"
+           exit 1
        fi
        sleep 1
     done
@@ -58,6 +59,9 @@ for j in `seq 1 10`; do
     fi
     if [ $j = "10" ]; then
        echo "Could not connect to /var/run/hostapd-global"
+       exit 1
     fi
     sleep 1
 done
+
+exit 0
index 98328ef7a587958d119e3f06b70273bb6f09266d..503a59a6bf99399641466e1d531cab9ed0bf06a3 100755 (executable)
@@ -52,6 +52,7 @@ for i in 0 1 2; do
        fi
        if [ $j = "10" ]; then
            echo "Could not connect to /tmp/wpas-wlan$i"
+           exit 1
        fi
        sleep 1
     done
@@ -63,6 +64,9 @@ for j in `seq 1 10`; do
     fi
     if [ $j = "10" ]; then
        echo "Could not connect to /var/run/hostapd-global"
+       exit 1
     fi
     sleep 1
 done
+
+exit 0