tests: Exit early if startup fails

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>
This commit is contained in:
Jouni Malinen 2013-09-28 18:19:38 +03:00
parent 6ca3a98bc2
commit 8d0825d655
3 changed files with 30 additions and 5 deletions

View file

@ -4,7 +4,10 @@ errors=0
umask 0002 umask 0002
if [ "x$1" = "xconcurrent-valgrind" ]; then 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-` DATE=`ls -1tr logs | tail -1 | cut -f1 -d-`
rm logs/last-debug rm logs/last-debug
for i in autogo discovery grpform; do for i in autogo discovery grpform; do
@ -22,7 +25,10 @@ if [ "x$1" = "xconcurrent-valgrind" ]; then
exit 1 exit 1
fi fi
elif [ "x$1" = "xconcurrent" ]; then 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-` DATE=`ls -1tr logs | tail -1 | cut -f1 -d-`
rm logs/last-debug rm logs/last-debug
for i in autogo discovery grpform; do for i in autogo discovery grpform; do
@ -35,7 +41,10 @@ elif [ "x$1" = "xconcurrent" ]; then
exit 1 exit 1
fi fi
elif [ "x$1" = "xvalgrind" ]; then 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-` DATE=`ls -1tr logs | tail -1 | cut -f1 -d-`
./run-tests.py -l logs/$DATE-run -e logs/$DATE-failed || errors=1 ./run-tests.py -l logs/$DATE-run -e logs/$DATE-failed || errors=1
cat logs/$DATE-run > logs/last-debug cat logs/$DATE-run > logs/last-debug
@ -50,7 +59,10 @@ elif [ "x$1" = "xvalgrind" ]; then
exit 1 exit 1
fi fi
elif [ "x$1" = "xtrace" ]; then 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-` 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 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 if [ -e logs/$DATE-failed ]; then
@ -64,7 +76,10 @@ elif [ "x$1" = "xtrace" ]; then
exit 1 exit 1
fi fi
else 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-` DATE=`ls -1tr logs | tail -1 | cut -f1 -d-`
./run-tests.py -l logs/$DATE-run -e logs/$DATE-failed || errors=1 ./run-tests.py -l logs/$DATE-run -e logs/$DATE-failed || errors=1
cat logs/$DATE-run > logs/last-debug cat logs/$DATE-run > logs/last-debug
@ -74,3 +89,5 @@ else
exit 1 exit 1
fi fi
fi fi
echo "ALL-PASSED"

View file

@ -47,6 +47,7 @@ for i in 0 1 2; do
fi fi
if [ $j = "10" ]; then if [ $j = "10" ]; then
echo "Could not connect to /tmp/wpas-wlan$i" echo "Could not connect to /tmp/wpas-wlan$i"
exit 1
fi fi
sleep 1 sleep 1
done done
@ -58,6 +59,9 @@ for j in `seq 1 10`; do
fi fi
if [ $j = "10" ]; then if [ $j = "10" ]; then
echo "Could not connect to /var/run/hostapd-global" echo "Could not connect to /var/run/hostapd-global"
exit 1
fi fi
sleep 1 sleep 1
done done
exit 0

View file

@ -52,6 +52,7 @@ for i in 0 1 2; do
fi fi
if [ $j = "10" ]; then if [ $j = "10" ]; then
echo "Could not connect to /tmp/wpas-wlan$i" echo "Could not connect to /tmp/wpas-wlan$i"
exit 1
fi fi
sleep 1 sleep 1
done done
@ -63,6 +64,9 @@ for j in `seq 1 10`; do
fi fi
if [ $j = "10" ]; then if [ $j = "10" ]; then
echo "Could not connect to /var/run/hostapd-global" echo "Could not connect to /var/run/hostapd-global"
exit 1
fi fi
sleep 1 sleep 1
done done
exit 0