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 <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2014-04-29 14:46:09 +03:00 committed by Jouni Malinen
parent 60b9422080
commit 521b7e7925
2 changed files with 12 additions and 1 deletions

View file

@ -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()

View 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)