tests: Speed up stop-wifi.sh

Split the long waits to iterations of shorter waits that can be stopped
based on processes having died.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-09-28 10:54:10 +03:00
parent 53b63a0a3f
commit d3b082371d

View file

@ -21,14 +21,29 @@ fi
if [ "$RUNNING" = "yes" ]; then if [ "$RUNNING" = "yes" ]; then
# give some time for hostapd and wpa_supplicant to complete deinit # give some time for hostapd and wpa_supplicant to complete deinit
sleep 4 sleep 0.5
for i in `seq 1 5`; do
if pidof wpa_supplicant hostapd valgrind.bin > /dev/null; then
echo "Waiting for processes to exit (1)"
sleep 1
else
break
fi
done
fi fi
if pidof wpa_supplicant hostapd > /dev/null; then if pidof wpa_supplicant hostapd > /dev/null; then
echo "wpa_supplicant/hostapd did not exit - try to force them to die" echo "wpa_supplicant/hostapd did not exit - try to force them to die"
sudo killall -9 -q hostapd sudo killall -9 -q hostapd
sudo killall -9 -q wpa_supplicant sudo killall -9 -q wpa_supplicant
sleep 5 for i in `seq 1 5`; do
if pidof wpa_supplicant hostapd > /dev/null; then
echo "Waiting for processes to exit (2)"
sleep 1
else
break
fi
done
fi fi
for i in `pidof valgrind.bin`; do for i in `pidof valgrind.bin`; do
@ -40,6 +55,7 @@ done
for i in /tmp/wpas-wlan0 /tmp/wpas-wlan1 /tmp/wpas-wlan2 /var/run/hostapd-global; do for i in /tmp/wpas-wlan0 /tmp/wpas-wlan1 /tmp/wpas-wlan2 /var/run/hostapd-global; do
if [ -e $i ]; then if [ -e $i ]; then
echo "Waiting for ctrl_iface $i to disappear"
sleep 1 sleep 1
if [ -e $i ]; then if [ -e $i ]; then
echo "Control interface file $i exists - remove it" echo "Control interface file $i exists - remove it"