From 4cfe369b98b3c0ecc205115a010542a8d7d175e9 Mon Sep 17 00:00:00 2001
From: Jouni Malinen <j@w1.fi>
Date: Mon, 22 Dec 2014 19:37:08 +0200
Subject: [PATCH] tests: Optimize stop.sh wait times

There is no need to wait for fixed 0.5 seconds for the processes to
exit.

Signed-off-by: Jouni Malinen <j@w1.fi>
---
 tests/hwsim/stop.sh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tests/hwsim/stop.sh b/tests/hwsim/stop.sh
index b73d1dcaa..5d23b5bd6 100755
--- a/tests/hwsim/stop.sh
+++ b/tests/hwsim/stop.sh
@@ -22,13 +22,15 @@ sudo killall -q hlr_auc_gw
 
 if [ "$RUNNING" = "yes" ]; then
     # give some time for hostapd and wpa_supplicant to complete deinit
-    sleep 0.5
-    for i in `seq 1 5`; do
-	if pidof wpa_supplicant hostapd valgrind.bin hlr_auc_gw > /dev/null; then
+    for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
+	if ! pidof wpa_supplicant hostapd valgrind.bin hlr_auc_gw > /dev/null; then
+	    break
+	fi
+	if [ $i -gt 10 ]; then
 	    echo "Waiting for processes to exit (1)"
 	    sleep 1
 	else
-	    break
+	    sleep 0.06
 	fi
     done
 fi