tests: Merge start-p2p-concurrent.sh functionality into start.sh

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-09-29 16:37:25 +03:00
parent 0d84c400f9
commit 66767f0f4a
3 changed files with 29 additions and 74 deletions

View file

@ -4,7 +4,7 @@ errors=0
umask 0002 umask 0002
if [ "x$1" = "xconcurrent-valgrind" ]; then if [ "x$1" = "xconcurrent-valgrind" ]; then
if ! ./start-p2p-concurrent.sh valgrind; then if ! ./start.sh concurrent valgrind; then
echo "Could not start test environment" > logs/last-debug echo "Could not start test environment" > logs/last-debug
exit 1 exit 1
fi fi
@ -25,7 +25,7 @@ if [ "x$1" = "xconcurrent-valgrind" ]; then
exit 1 exit 1
fi fi
elif [ "x$1" = "xconcurrent" ]; then elif [ "x$1" = "xconcurrent" ]; then
if ! ./start-p2p-concurrent.sh; then if ! ./start.sh concurrent; then
echo "Could not start test environment" > logs/last-debug echo "Could not start test environment" > logs/last-debug
exit 1 exit 1
fi fi

View file

@ -1,67 +0,0 @@
#!/bin/sh
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
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
sudo iw wlan1 interface add sta1 type station
sudo iw wlan2 interface add sta2 type station
mkdir -p $DIR/logs
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 > $DIR/logs/$DATE-tcpdump 2>&1 &
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*
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"
exit 1
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"
exit 1
fi
sleep 1
done
exit 0

View file

@ -6,35 +6,57 @@ WPACLI=$DIR/../../wpa_supplicant/wpa_cli
HAPD=$DIR/../../hostapd/hostapd HAPD=$DIR/../../hostapd/hostapd
WLANTEST=$DIR/../../wlantest/wlantest WLANTEST=$DIR/../../wlantest/wlantest
if [ "x$1" = "xvalgrind" ]; then if [ "$1" = "concurrent" ]; then
CONCURRENT=y
shift
else
unset CONCURRENT
fi
if [ "$1" = "valgrind" ]; then
VALGRIND=y VALGRIND=y
shift
else else
unset VALGRIND unset VALGRIND
fi fi
if [ "x$1" = "xtrace" ]; then if [ "$1" = "trace" ]; then
TRACE="T" TRACE="T"
shift
else else
TRACE="" TRACE=""
fi fi
$DIR/stop-wifi.sh $DIR/stop-wifi.sh
sudo modprobe mac80211_hwsim radios=5 sudo modprobe mac80211_hwsim radios=5
if [ "$CONCURRENT" = "y" ]; then
sudo iw wlan0 interface add sta0 type station
sudo iw wlan1 interface add sta1 type station
sudo iw wlan2 interface add sta2 type station
fi
mkdir -p $DIR/logs mkdir -p $DIR/logs
DATE=`date +%s` DATE=`date +%s`
sudo ifconfig hwsim0 up sudo ifconfig hwsim0 up
sudo $WLANTEST -i hwsim0 -c -d > $DIR/logs/$DATE-hwsim0 & sudo $WLANTEST -i hwsim0 -c -d > $DIR/logs/$DATE-hwsim0 &
sudo tcpdump -ni hwsim0 -s 2500 -w $DIR/logs/$DATE-hwsim0.dump > $DIR/logs/$DATE-tcpdump 2>&1 & sudo tcpdump -ni hwsim0 -s 2500 -w $DIR/logs/$DATE-hwsim0.dump > $DIR/logs/$DATE-tcpdump 2>&1 &
if [ "x$VALGRIND" = "xy" ]; then if [ "$VALGRIND" = "y" ]; then
for i in 0 1 2; do for i in 0 1 2; do
chmod a+rx $WPAS chmod a+rx $WPAS
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 & if [ "$CONCURRENT" = "y" ]; then
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$TRACE > $DIR/logs/$DATE-log$i &
else
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$TRACE > $DIR/logs/$DATE-log$i &
fi
done done
chmod a+rx $HAPD chmod a+rx $HAPD
sudo valgrind --log-file=$DIR/logs/$DATE-valgrind-hostapd $HAPD -ddKt -g /var/run/hostapd-global -G admin -ddKt > $DIR/logs/$DATE-hostapd & sudo valgrind --log-file=$DIR/logs/$DATE-valgrind-hostapd $HAPD -ddKt -g /var/run/hostapd-global -G admin -ddKt > $DIR/logs/$DATE-hostapd &
else else
for i in 0 1 2; do for i in 0 1 2; do
sudo $WPAS -g /tmp/wpas-wlan$i -Gadmin -Dnl80211 -iwlan$i -c $DIR/p2p$i.conf -ddKt$TRACE > $DIR/logs/$DATE-log$i & if [ "$CONCURRENT" = "y" ]; then
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$TRACE > $DIR/logs/$DATE-log$i &
else
sudo $WPAS -g /tmp/wpas-wlan$i -Gadmin -Dnl80211 -iwlan$i -c $DIR/p2p$i.conf -ddKt$TRACE > $DIR/logs/$DATE-log$i &
fi
done done
sudo $HAPD -ddKt -g /var/run/hostapd-global -G admin -ddKt > $DIR/logs/$DATE-hostapd & sudo $HAPD -ddKt -g /var/run/hostapd-global -G admin -ddKt > $DIR/logs/$DATE-hostapd &
fi fi