tests: Add support for using Linux kernel tracing functionality

run-all.sh and start.sh scripts can now take 'trace' command line
argument to request Linux tracing information from mac80211, cfg80211,
and wpa_supplicant to be recorded.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-09-28 10:36:56 +03:00
parent 298f51857d
commit 53b63a0a3f
2 changed files with 21 additions and 1 deletions

View file

@ -49,6 +49,20 @@ elif [ "x$1" = "xvalgrind" ]; then
tar czf /tmp/hwsim-tests-$DATE-FAILED-valgrind.tar.gz logs/$DATE*
exit 1
fi
elif [ "x$1" = "xtrace" ]; then
./start.sh trace
DATE=`ls -1tr logs | tail -1 | cut -f1 -d-`
sudo trace-cmd record -o logs/$DATE-trace.dat -e mac80211 -e cfg80211 su $USER -c "./run-tests.py -l logs/$DATE-run -e logs/$DATE-failed" || errors=1
if [ -e logs/$DATE-failed ]; then
error=1
fi
sudo chown $USER logs/$DATE-trace.dat
cat logs/$DATE-run > logs/last-debug
./stop-wifi.sh
if [ $errors -gt 0 ]; then
tar czf /tmp/hwsim-tests-$DATE-FAILED-trace.tar.gz logs/$DATE*
exit 1
fi
else
./start.sh
DATE=`ls -1tr logs | tail -1 | cut -f1 -d-`

View file

@ -12,6 +12,12 @@ else
unset VALGRIND
fi
if [ "x$1" = "xtrace" ]; then
TRACE="T"
else
TRACE=""
fi
$DIR/stop-wifi.sh
sudo modprobe mac80211_hwsim radios=5
mkdir -p $DIR/logs
@ -28,7 +34,7 @@ if [ "x$VALGRIND" = "xy" ]; then
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 &
sudo $WPAS -g /tmp/wpas-wlan$i -Gadmin -Dnl80211 -iwlan$i -c $DIR/p2p$i.conf -ddKt$TRACE > $DIR/logs/$DATE-log$i &
done
sudo $HAPD -ddKt -g /var/run/hostapd-global -G admin -ddKt > $DIR/logs/$DATE-hostapd &
fi