From 15f7b02c95fb7905e7e321a725fa0ad25024b6c1 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 27 Aug 2013 16:01:04 +0300 Subject: [PATCH] tests: Wait for hostapd/wpa_supplicant to reply at start (concurrent) Instead of waiting for a fixed duration, poll hostapd/wpa_supplicant through the control interface until they are ready to reply in order to avoid starting test case execution too early. This is like commit b76579e0c09a1a763b70d63613377b407cbc405f but for the concurrent P2P test cases that were forgotten from that commit. Signed-hostap: Jouni Malinen --- tests/hwsim/start-p2p-concurrent.sh | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/start-p2p-concurrent.sh b/tests/hwsim/start-p2p-concurrent.sh index 5f0608e36..c038f339f 100755 --- a/tests/hwsim/start-p2p-concurrent.sh +++ b/tests/hwsim/start-p2p-concurrent.sh @@ -2,6 +2,7 @@ DIR="$( cd "$( dirname "$0" )" && pwd )" WPAS=$DIR/../../wpa_supplicant/wpa_supplicant +WPACLI=$DIR/../../wpa_supplicant/wpa_cli HAPD=$DIR/../../hostapd/hostapd WLANTEST=$DIR/../../wlantest/wlantest @@ -36,5 +37,27 @@ sleep 1 sudo chown $USER $DIR/logs/$DATE-hwsim0.dump if [ "x$VALGRIND" = "xy" ]; then sudo chown $USER $DIR/logs/$DATE-valgrind* - sleep 10 fi + +# wait for programs to be fully initialized +for i in 0 1 2; do + for j in `seq 1 10`; do + if $WPACLI -g /tmp/wpas-wlan$i ping | grep -q PONG; then + break + fi + if [ $j = "10" ]; then + echo "Could not connect to /tmp/wpas-wlan$i" + fi + sleep 1 + done +done + +for j in `seq 1 10`; do + if $WPACLI -g /var/run/hostapd-global ping | grep -q PONG; then + break + fi + if [ $j = "10" ]; then + echo "Could not connect to /var/run/hostapd-global" + fi + sleep 1 +done