]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Verify global control interface before starting each test
authorJouni Malinen <jouni@qca.qualcomm.com>
Tue, 29 Apr 2014 11:46:09 +0000 (14:46 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 29 Apr 2014 12:20:23 +0000 (15:20 +0300)
This allows control interface issues to be caught in a bit more readable
way in the debug logs. In addition, dump pending monitor socket
information more frequently and within each test case in the log files
to make the output clearer and less likely to go over the socket buffer
limit.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests/hwsim/run-tests.py
tests/hwsim/wpasupplicant.py

index 6e490e094fd1e1b476e3d37d963e7fb09609d9f6..1e4ccb95296e3eba94d6498ff64be7a0059186bd 100755 (executable)
@@ -342,6 +342,11 @@ def main():
             start = datetime.now()
             for d in dev:
                 try:
+                    d.dump_monitor()
+                    if not d.ping():
+                        raise Exception("PING failed for {}".format(d.ifname))
+                    if not d.global_ping():
+                        raise Exception("Global PING failed for {}".format(d.ifname))
                     d.request("NOTE TEST-START " + name)
                 except Exception, e:
                     logger.info("Failed to issue TEST-START before " + name + " for " + d.ifname)
@@ -370,6 +375,7 @@ def main():
                 result = "FAIL"
             for d in dev:
                 try:
+                    d.dump_monitor()
                     d.request("NOTE TEST-STOP " + name)
                 except Exception, e:
                     logger.info("Failed to issue TEST-STOP after {} for {}".format(name, d.ifname))
@@ -377,6 +383,7 @@ def main():
                     result = "FAIL"
             try:
                 wpas = WpaSupplicant("wlan5", "/tmp/wpas-wlan5")
+                d.dump_monitor()
                 rename_log(args.logdir, 'log5', name, wpas)
                 if not args.no_reset:
                     wpas.remove_ifname()
index 24d5dbfe0dc8e67ae6ae945c4e832f4717dd5e65..bd69c97b69486003c96f96a38f6ae54ea97f494a 100644 (file)
@@ -69,7 +69,7 @@ class WpaSupplicant:
             self.request(cmd)
         else:
             ifname = self.ifname or self.global_iface
-            logger.debug(ifname + ": CTRL: " + cmd)
+            logger.debug(ifname + ": CTRL(global): " + cmd)
             return self.global_ctrl.request(cmd)
 
     def group_request(self, cmd):
@@ -82,7 +82,11 @@ class WpaSupplicant:
     def ping(self):
         return "PONG" in self.request("PING")
 
+    def global_ping(self):
+        return "PONG" in self.global_request("PING")
+
     def reset(self):
+        self.dump_monitor()
         res = self.request("FLUSH")
         if not "OK" in res:
             logger.info("FLUSH to " + self.ifname + " failed: " + res)