]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hwsim tests: Move logging into timestamped subdirectory
authorJohannes Berg <johannes.berg@intel.com>
Wed, 30 Oct 2013 21:08:10 +0000 (22:08 +0100)
committerJouni Malinen <j@w1.fi>
Thu, 31 Oct 2013 09:07:26 +0000 (11:07 +0200)
Instead of logging many files called "<timestamp>-*", log into
a new "<timestamp>/*" in the logs/ subdirectory and only put
the last-debug file into logs/. If a LOGDIR is specified in the
environment, instead just put everything into that directory
(so the caller should make sure to give it a timestamp or so)
and skip the creation of last-debug entirely.

Also clean up a bit and pass the LOGDIR from run-all.sh to
start.sh rather than having start.sh create the timestamp and
run-all.sh detect the latest one when having run start.sh.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

tests/hwsim/run-all.sh
tests/hwsim/start.sh

index bef49f92b40c7fe11e91152506549d9b89768dde..22b4f4315871d8b0d70e0850a7b75a39c1d71216 100755 (executable)
@@ -3,9 +3,14 @@
 errors=0
 umask 0002
 
+DATE="$(date +%s)"
+unset LOGBASEDIR
 if [ -z "$LOGDIR" ]; then
-       LOGDIR=logs
+       LOGBASEDIR=logs
+       LOGDIR=$LOGBASEDIR/$DATE
+       mkdir -p $LOGDIR
 fi
+export LOGDIR
 
 if [ -z "$DBFILE" ]; then
     DB=""
@@ -52,25 +57,32 @@ else
 fi
 
 if ! ./start.sh $CONCURRENT $VALGRIND $TRACE; then
-       echo "Could not start test environment" > $LOGDIR/last-debug
+       if ! [ -z "$LOGBASEDIR" ] ; then
+               echo "Could not start test environment" > $LOGDIR/run
+       fi
        exit 1
 fi
-DATE=`ls -1tr $LOGDIR | tail -1 | cut -f1 -d-`
-rm $LOGDIR/last-debug 2>/dev/null
-./run-tests.py $TRACE_ARGS -l $LOGDIR/$DATE-run $DB -e $LOGDIR/$DATE-failed -r $LOGDIR/results.txt $CONCURRENT_TESTS $@ || errors=1
 
-cat $LOGDIR/$DATE-run >> $LOGDIR/last-debug
+if ! [ -z "$LOGBASEDIR" ] ; then
+       rm $LOGBASEDIR/last-debug 2>/dev/null
+fi
+./run-tests.py $TRACE_ARGS -l $LOGDIR/run $DB -e $LOGDIR/failed -r $LOGDIR/results.txt $CONCURRENT_TESTS $@ || errors=1
+
+if ! [ -z "$LOGBASEDIR" ] ; then
+       cat $LOGDIR/run >> $LOGBASEDIR/last-debug
+fi
+
 ./stop-wifi.sh
 
 if [ ! -z "$VALGRIND" ] ; then
-    failures=`grep "ERROR SUMMARY" $LOGDIR/$DATE-valgrind-* | grep -v " 0 errors" | wc -l`
+    failures=`grep "ERROR SUMMARY" $LOGDIR/valgrind-* | grep -v " 0 errors" | wc -l`
     if [ $failures -gt 0 ]; then
        echo "Mark as failed due to valgrind errors"
        errors=1
     fi
 fi
 if [ $errors -gt 0 ]; then
-    tar czf /tmp/hwsim-tests-$DATE-FAILED$SUFFIX.tar.gz $LOGDIR/$DATE*
+    tar czf /tmp/hwsim-tests-$DATE-FAILED$SUFFIX.tar.gz $LOGDIR/
     exit 1
 fi
 
index d2c806e6775372952dcb1f7adde66c5dd65ed5ff..1f67002eb33b5289c15eea9da81caab4b0270e70 100755 (executable)
@@ -7,12 +7,10 @@ HAPD=$DIR/../../hostapd/hostapd
 WLANTEST=$DIR/../../wlantest/wlantest
 HLR_AUC_GW=$DIR/../../hostapd/hlr_auc_gw
 
-DATE=`date +%s`
-
 if [ -z "$LOGDIR" ] ; then
-    LOGDIR=$DIR/logs
+    LOGDIR="$DIR/logs/$(date +%s)"
+    mkdir -p $LOGDIR
 fi
-export LOGDIR
 
 if groups | tr ' ' "\n" | grep -q ^admin$; then
     GROUP=admin
@@ -31,8 +29,8 @@ fi
 
 if [ "$1" = "valgrind" ]; then
     VALGRIND=y
-    VALGRIND_WPAS="valgrind --log-file=$LOGDIR/$DATE-valgrind-wlan%d"
-    VALGRIND_HAPD="valgrind --log-file=$LOGDIR/$DATE-valgrind-hostapd"
+    VALGRIND_WPAS="valgrind --log-file=$LOGDIR/valgrind-wlan%d"
+    VALGRIND_HAPD="valgrind --log-file=$LOGDIR/valgrind-hostapd"
     chmod -f a+rx $WPAS
     chmod -f a+rx $HAPD
     shift
@@ -58,25 +56,25 @@ if [ "$CONCURRENT" = "y" ]; then
 fi
 mkdir -p $LOGDIR
 sudo ifconfig hwsim0 up
-sudo $WLANTEST -i hwsim0 -c -d > $LOGDIR/$DATE-hwsim0 &
-sudo tcpdump -ni hwsim0 -s 2500 -w $LOGDIR/$DATE-hwsim0.dump > $LOGDIR/$DATE-tcpdump 2>&1 &
+sudo $WLANTEST -i hwsim0 -c -d > $LOGDIR/hwsim0 &
+sudo tcpdump -ni hwsim0 -s 2500 -w $LOGDIR/hwsim0.dump > $LOGDIR/tcpdump 2>&1 &
 for i in 0 1 2; do
     sudo $(printf -- "$VALGRIND_WPAS" $i) $WPAS -g /tmp/wpas-wlan$i -G$GROUP -Dnl80211 -iwlan$i -c $DIR/p2p$i.conf \
-         $(printf -- "$CONCURRENT_ARGS" $i) -ddKt$TRACE > $LOGDIR/$DATE-log$i &
+         $(printf -- "$CONCURRENT_ARGS" $i) -ddKt$TRACE > $LOGDIR/log$i &
 done
-sudo $VALGRIND_HAPD $HAPD -ddKt$TRACE -g /var/run/hostapd-global -G $GROUP -ddKt > $LOGDIR/$DATE-hostapd &
+sudo $VALGRIND_HAPD $HAPD -ddKt$TRACE -g /var/run/hostapd-global -G $GROUP -ddKt > $LOGDIR/hostapd &
 
 sleep 1
-sudo chown $USER $LOGDIR/$DATE-hwsim0.dump
+sudo chown $USER $LOGDIR/hwsim0.dump
 if [ "x$VALGRIND" = "xy" ]; then
-    sudo chown $USER $LOGDIR/$DATE-*valgrind*
+    sudo chown $USER $LOGDIR/*valgrind*
 fi
 
 if [ -x $HLR_AUC_GW ]; then
-    $HLR_AUC_GW -m $DIR/auth_serv/hlr_auc_gw.milenage_db > $LOGDIR/$DATE-hlr_auc_gw &
+    $HLR_AUC_GW -m $DIR/auth_serv/hlr_auc_gw.milenage_db > $LOGDIR/hlr_auc_gw &
 fi
 
-$HAPD -ddKt $DIR/auth_serv/as.conf > $LOGDIR/$DATE-auth_serv &
+$HAPD -ddKt $DIR/auth_serv/as.conf > $LOGDIR/auth_serv &
 
 # wait for programs to be fully initialized
 for i in 0 1 2; do