Browse Source

tests: Split hostapd debug log into per test case files

Signed-hostap: Jouni Malinen <j@w1.fi>
Jouni Malinen 11 years ago
parent
commit
75428961d9
4 changed files with 23 additions and 4 deletions
  1. 1 2
      tests/hwsim/README
  2. 3 0
      tests/hwsim/hostapd.py
  3. 17 0
      tests/hwsim/run-tests.py
  4. 2 2
      tests/hwsim/start.sh

+ 1 - 2
tests/hwsim/README

@@ -137,10 +137,9 @@ 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
-- hostapd = hostapd debug log
+- *.hostapd = hostapd debug log
 - hwsim0 = wlantest debug log
 - hwsim0.pcapng = capture with all frames exchanged during the tests
-- tcpdump = tcpdump output
 - *.log = debug prints from the test scripts
 - trace.dat = Linux tracing record (if enabled)
 - hlr_auc_gw - hlr_auc_gw (EAP-SIM/AKA/AKA' authentication) log

+ 3 - 0
tests/hwsim/hostapd.py

@@ -33,6 +33,9 @@ class HostapdGlobal:
     def remove(self, ifname):
         self.ctrl.request("REMOVE " + ifname)
 
+    def relog(self):
+        self.ctrl.request("RELOG")
+
 
 class Hostapd:
     def __init__(self, ifname):

+ 17 - 0
tests/hwsim/run-tests.py

@@ -304,6 +304,23 @@ def main():
                     logger.info("Failed to rename log files")
                     logger.info(e)
 
+            try:
+                import getpass
+                srcname = os.path.join(args.logdir, 'hostapd')
+                dstname = os.path.join(args.logdir, name + '.hostapd')
+                num = 0
+                while os.path.exists(dstname):
+                    dstname = os.path.join(args.logdir, name + '.hostapd-' + str(num))
+                    num = num + 1
+                os.rename(srcname, dstname)
+                hapd = HostapdGlobal()
+                hapd.relog()
+                subprocess.call(['sudo', 'chown', '-f', getpass.getuser(),
+                                 srcname])
+            except Exception, e:
+                logger.info("Failed to rename hostapd log file")
+                logger.info(e)
+
         end = datetime.now()
         diff = end - start
         report(conn, args.prefill, args.build, args.commit, run, name, result, diff.total_seconds())

+ 2 - 2
tests/hwsim/start.sh

@@ -64,10 +64,10 @@ 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 -f $LOGDIR/log$i &
 done
-sudo $VALGRIND_HAPD $HAPD -ddKt$TRACE -g /var/run/hostapd-global -G $GROUP -ddKt > $LOGDIR/hostapd &
+sudo $VALGRIND_HAPD $HAPD -ddKt$TRACE -g /var/run/hostapd-global -G $GROUP -ddKt -f $LOGDIR/hostapd &
 
 sleep 1
-sudo chown -f $USER $LOGDIR/hwsim0.pcapng $LOGDIR/log*
+sudo chown -f $USER $LOGDIR/hwsim0.pcapng $LOGDIR/log* $LOGDIR/hostapd
 if [ "x$VALGRIND" = "xy" ]; then
     sudo chown -f $USER $LOGDIR/*valgrind*
 fi