]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Add option to run test cases under valgrind/concurrent P2P
authorJouni Malinen <j@w1.fi>
Sat, 24 Aug 2013 17:33:21 +0000 (20:33 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 24 Aug 2013 17:33:21 +0000 (20:33 +0300)
./run-all.sh can now take an optional argument to select whether to run
all test cases as before (default), to run these under valgrind
("valgrind"), to run P2P test cases with concurrent station interface
("concurrent"), or the concurrent P2P test cases under valgrind
("concurrent-valgrind").

valgrind cases report errors if a test case fails or valgrind reports an
error.

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

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

index 3ef4666f75267d3a018e101896df4c2b8e5bf3ae..5d409cfe039ba42e25646dac98d8d195225b7391 100755 (executable)
@@ -2,11 +2,55 @@
 
 errors=0
 umask 0002
-./start.sh
-DATE=`ls -1tr logs | tail -1 | cut -f1 -d-`
-./run-tests.py -e logs/$DATE-failed || errors=1
-./stop-wifi.sh
-if [ $errors -gt 0 ]; then
-    tar czf /tmp/hwsim-tests-$DATE-FAILED.tar.gz logs/$DATE*
-    exit 1
+
+if [ "x$1" = "xconcurrent-valgrind" ]; then
+    ./start-p2p-concurrent.sh valgrind
+    DATE=`ls -1tr logs | tail -1 | cut -f1 -d-`
+    for i in autogo discovery grpform; do
+       ./run-tests.py -e logs/$DATE-failed-$i -f test_p2p_$i.py || errors=1
+    done
+    ./stop-wifi.sh valgrind
+    failures=`grep "ERROR SUMMARY" logs/$DATE-valgrind-* | grep -v " 0 errors" | wc -l`
+    if [ $failures -gt 0 ]; then
+       echo "Mark as failed due to valgrind errors"
+       errors=1
+    fi
+    if [ $errors -gt 0 ]; then
+       tar czf /tmp/hwsim-tests-$DATE-FAILED-concurrent-valgrind.tar.gz logs/$DATE*
+       exit 1
+    fi
+elif [ "x$1" = "xconcurrent" ]; then
+    ./start-p2p-concurrent.sh
+    DATE=`ls -1tr logs | tail -1 | cut -f1 -d-`
+    for i in autogo discovery grpform; do
+       ./run-tests.py -e logs/$DATE-failed-$i -f test_p2p_$i.py || errors=1
+    done
+    ./stop-wifi.sh
+    if [ $errors -gt 0 ]; then
+       tar czf /tmp/hwsim-tests-$DATE-FAILED-concurrent.tar.gz logs/$DATE*
+       exit 1
+    fi
+elif [ "x$1" = "xvalgrind" ]; then
+    ./start.sh valgrind
+    DATE=`ls -1tr logs | tail -1 | cut -f1 -d-`
+    ./run-tests.py -e logs/$DATE-failed || errors=1
+    ./stop-wifi.sh valgrind
+    failures=`grep "ERROR SUMMARY" logs/$DATE-valgrind-* | grep -v " 0 errors" | wc -l`
+    if [ $failures -gt 0 ]; then
+       echo "Mark as failed due to valgrind errors"
+       errors=1
+    fi
+    if [ $errors -gt 0 ]; then
+       tar czf /tmp/hwsim-tests-$DATE-FAILED-valgrind.tar.gz logs/$DATE*
+       exit 1
+    fi
+else
+    ./start.sh
+    DATE=`ls -1tr logs | tail -1 | cut -f1 -d-`
+    ./run-tests.py -e logs/$DATE-failed || errors=1
+    ./stop-wifi.sh
+    if [ $errors -gt 0 ]; then
+       tar czf /tmp/hwsim-tests-$DATE-FAILED.tar.gz logs/$DATE*
+       exit 1
+    fi
 fi
index 83727b048db745bb639c574bbeb107e3b50d3bb2..294d96bff61a95c16630be8c2cb2628c26b1255f 100755 (executable)
@@ -5,6 +5,12 @@ WPAS=$DIR/../../wpa_supplicant/wpa_supplicant
 HAPD=$DIR/../../hostapd/hostapd
 WLANTEST=$DIR/../../wlantest/wlantest
 
+if [ "x$1" = "xvalgrind" ]; then
+    VALGRIND=y
+else
+    unset VALGRIND
+fi
+
 $DIR/stop-wifi.sh
 sudo modprobe mac80211_hwsim radios=5
 sudo iw wlan0 interface add sta0 type station
@@ -15,9 +21,20 @@ DATE=`date +%s`
 sudo ifconfig hwsim0 up
 sudo $WLANTEST -i hwsim0 -c -d > $DIR/logs/$DATE-hwsim0 &
 sudo tcpdump -ni hwsim0 -s 2500 -w $DIR/logs/$DATE-hwsim0.dump &
-sudo $WPAS -g /tmp/wpas-wlan0 -Gadmin -Dnl80211 -iwlan0 -c $DIR/p2p0.conf -N -Dnl80211 -ista0 -c $DIR/sta-dummy.conf -ddKt > $DIR/logs/$DATE-log0 &
-sudo $WPAS -g /tmp/wpas-wlan1 -Gadmin -Dnl80211 -iwlan1 -c $DIR/p2p1.conf -N -Dnl80211 -ista1 -c $DIR/sta-dummy.conf -ddKt > $DIR/logs/$DATE-log1 &
-sudo $WPAS -g /tmp/wpas-wlan2 -Gadmin -Dnl80211 -iwlan2 -c $DIR/p2p2.conf -N -Dnl80211 -ista2 -c $DIR/sta-dummy.conf -ddKt > $DIR/logs/$DATE-log2 &
-sudo $HAPD -ddKt -g /var/run/hostapd-global -G admin -ddKt > $DIR/logs/$DATE-hostapd &
+if [ "x$VALGRIND" = "xy" ]; then
+    for i in 0 1 2; do
+       sudo valgrind --log-file=$DIR/logs/$DATE-valgrind-wlan$i $WPAS -g /tmp/wpas-wlan$i -Gadmin -Dnl80211 -iwlan$i -c $DIR/p2p$i.conf -N -Dnl80211 -ista$i -c $DIR/sta-dummy.conf -ddKt > $DIR/logs/$DATE-log$i &
+    done
+    sudo valgrind --log-file=$DIR/logs/$DATE-valgrind-hostapd $HAPD -ddKt -g /var/run/hostapd-global -G admin -ddKt > $DIR/logs/$DATE-hostapd &
+else
+    for i in 0 1 2; do
+       sudo $WPAS -g /tmp/wpas-wlan$i -Gadmin -Dnl80211 -iwlan$i -c $DIR/p2p$i.conf -N -Dnl80211 -ista$i -c $DIR/sta-dummy.conf -ddKt > $DIR/logs/$DATE-log$i &
+    done
+    sudo $HAPD -ddKt -g /var/run/hostapd-global -G admin -ddKt > $DIR/logs/$DATE-hostapd &
+fi
 sleep 1
 sudo chown $USER $DIR/logs/$DATE-hwsim0.dump
+if [ "x$VALGRIND" = "xy" ]; then
+    sudo chown $USER $DIR/logs/$DATE-valgrind*
+    sleep 2
+fi
index be5070dd5974f72ef22419c79c39b0b3113121d4..5d97b8a9d262e0ca48949e69fce39aa07b790888 100755 (executable)
@@ -5,6 +5,12 @@ WPAS=$DIR/../../wpa_supplicant/wpa_supplicant
 HAPD=$DIR/../../hostapd/hostapd
 WLANTEST=$DIR/../../wlantest/wlantest
 
+if [ "x$1" = "xvalgrind" ]; then
+    VALGRIND=y
+else
+    unset VALGRIND
+fi
+
 $DIR/stop-wifi.sh
 sudo modprobe mac80211_hwsim radios=5
 mkdir -p $DIR/logs
@@ -12,9 +18,20 @@ DATE=`date +%s`
 sudo ifconfig hwsim0 up
 sudo $WLANTEST -i hwsim0 -c -d > $DIR/logs/$DATE-hwsim0 &
 sudo tcpdump -ni hwsim0 -s 2500 -w $DIR/logs/$DATE-hwsim0.dump &
-sudo $WPAS -g /tmp/wpas-wlan0 -Gadmin -Dnl80211 -iwlan0 -c $DIR/p2p0.conf -ddKt > $DIR/logs/$DATE-log0 &
-sudo $WPAS -g /tmp/wpas-wlan1 -Gadmin -Dnl80211 -iwlan1 -c $DIR/p2p1.conf -ddKt > $DIR/logs/$DATE-log1 &
-sudo $WPAS -g /tmp/wpas-wlan2 -Gadmin -Dnl80211 -iwlan2 -c $DIR/p2p2.conf -ddKt > $DIR/logs/$DATE-log2 &
-sudo $HAPD -ddKt -g /var/run/hostapd-global -G admin -ddKt > $DIR/logs/$DATE-hostapd &
+if [ "x$VALGRIND" = "xy" ]; then
+    for i in 0 1 2; do
+       sudo valgrind --log-file=$DIR/logs/$DATE-valgrind-wlan$i $WPAS -g /tmp/wpas-wlan$i -Gadmin -Dnl80211 -iwlan$i -c $DIR/p2p$i.conf -ddKt > $DIR/logs/$DATE-log$i &
+    done
+    sudo valgrind --log-file=$DIR/logs/$DATE-valgrind-hostapd $HAPD -ddKt -g /var/run/hostapd-global -G admin -ddKt > $DIR/logs/$DATE-hostapd &
+else
+    for i in 0 1 2; do
+       sudo $WPAS -g /tmp/wpas-wlan$i -Gadmin -Dnl80211 -iwlan$i -c $DIR/p2p$i.conf -ddKt > $DIR/logs/$DATE-log$i &
+    done
+    sudo $HAPD -ddKt -g /var/run/hostapd-global -G admin -ddKt > $DIR/logs/$DATE-hostapd &
+fi
 sleep 1
 sudo chown $USER $DIR/logs/$DATE-hwsim0.dump
+if [ "x$VALGRIND" = "xy" ]; then
+    sudo chown $USER $DIR/logs/$DATE-*valgrind*
+    sleep 2
+fi
index 6464e67ec7a9ea7c92c6955910b3db8ee85504e0..a9f286503020158dbc6144dcc50d094ca4208b30 100755 (executable)
@@ -2,6 +2,9 @@
 
 sudo killall -q hostapd
 sudo killall -q wpa_supplicant
+if [ "x$1" = "xvalgrind" ]; then
+    sudo kill `pidof valgrind.bin`
+fi
 sudo killall -q wlantest
 sudo killall -q tcpdump
 if grep -q hwsim0 /proc/net/dev; then