tests: Split wpa_supplicant debug logs into per test case files
authorJouni Malinen <jouni@qca.qualcomm.com>
Thu, 31 Oct 2013 11:09:14 +0000 (13:09 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 31 Oct 2013 11:19:38 +0000 (13:19 +0200)
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

tests/hwsim/README
tests/hwsim/run-tests.py
tests/hwsim/start.sh

index 4288483..3c88f30 100644 (file)
@@ -134,9 +134,9 @@ conditions:
 run-all.sh directs debug logs into the logs subdirectory (or $LOGDIR if
 present in the environment). Log file names include the current UNIX
 timestamp and a postfix to identify the specific log:
-- log0 = wpa_supplicant debug log for the first radio
-- log1 = wpa_supplicant debug log for the second radio
-- log2 = wpa_supplicant debug log for the third radio
+- *.log0 = wpa_supplicant debug log for the first radio
+- *.log1 = wpa_supplicant debug log for the second radio
+- *.log2 = wpa_supplicant debug log for the third radio
 - hostapd = hostapd debug log
 - hwsim0 = wlantest debug log
 - hwsim0.pcapng = capture with all frames exchanged during the tests
index 536456e..9486c7f 100755 (executable)
@@ -297,6 +297,23 @@ def main():
                     logger.info(e)
             reset_devs(dev, apdev)
 
+            for i in range(0, 3):
+                try:
+                    import getpass
+                    srcname = os.path.join(args.logdir, 'log' + str(i))
+                    dstname = os.path.join(args.logdir, name + '.log' + str(i))
+                    num = 0
+                    while os.path.exists(dstname):
+                        dstname = os.path.join(args.logdir, name + '.log' + str(i) + '-' + str(num))
+                        num = num + 1
+                    os.rename(srcname, dstname)
+                    dev[i].request("RELOG")
+                    subprocess.call(['sudo', 'chown', '-f', getpass.getuser(),
+                                     srcname])
+                except Exception, e:
+                    logger.info("Failed to rename log files")
+                    logger.info(e)
+
     if log_handler:
         log_handler.stream.close()
         logger.removeHandler(log_handler)
index df16753..df07627 100755 (executable)
@@ -59,12 +59,12 @@ sudo ifconfig hwsim0 up
 sudo $WLANTEST -i hwsim0 -n $LOGDIR/hwsim0.pcapng -c -d > $LOGDIR/hwsim0 &
 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/log$i &
+         $(printf -- "$CONCURRENT_ARGS" $i) -ddKt$TRACE -f $LOGDIR/log$i &
 done
 sudo $VALGRIND_HAPD $HAPD -ddKt$TRACE -g /var/run/hostapd-global -G $GROUP -ddKt > $LOGDIR/hostapd &
 
 sleep 1
-sudo chown -f $USER $LOGDIR/hwsim0.pcapng
+sudo chown -f $USER $LOGDIR/hwsim0.pcapng $LOGDIR/log*
 if [ "x$VALGRIND" = "xy" ]; then
     sudo chown -f $USER $LOGDIR/*valgrind*
 fi