From 521b7e7925058055b5e569d18435bd9c1769b6a9 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 29 Apr 2014 14:46:09 +0300 Subject: [PATCH] tests: Verify global control interface before starting each test 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 --- tests/hwsim/run-tests.py | 7 +++++++ tests/hwsim/wpasupplicant.py | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py index 6e490e094..1e4ccb952 100755 --- a/tests/hwsim/run-tests.py +++ b/tests/hwsim/run-tests.py @@ -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() diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index 24d5dbfe0..bd69c97b6 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -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)