From 353e5067ff8e2c5289a15400ea8ea918d24a229c Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 31 Oct 2013 13:09:14 +0200 Subject: [PATCH] tests: Split wpa_supplicant debug logs into per test case files Signed-hostap: Jouni Malinen --- tests/hwsim/README | 6 +++--- tests/hwsim/run-tests.py | 17 +++++++++++++++++ tests/hwsim/start.sh | 4 ++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/tests/hwsim/README b/tests/hwsim/README index 42884831f..3c88f30ec 100644 --- a/tests/hwsim/README +++ b/tests/hwsim/README @@ -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 diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py index 536456eb5..9486c7fdc 100755 --- a/tests/hwsim/run-tests.py +++ b/tests/hwsim/run-tests.py @@ -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) diff --git a/tests/hwsim/start.sh b/tests/hwsim/start.sh index df1675353..df076277e 100755 --- a/tests/hwsim/start.sh +++ b/tests/hwsim/start.sh @@ -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