hwsim tests: Refactor test results reporting

Refactor the test reporting to treat the different results
(success/skip/failure) identically. This makes the timing
seem a bit longer, but cleans up the code which will allow
for adding more checks (e.g., on the captured data files)
later.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg 2013-10-31 15:02:50 +01:00 committed by Jouni Malinen
parent 1cd3eae362
commit 4a1b8901ab

View file

@ -247,32 +247,16 @@ def main():
res = t(dev, apdev) res = t(dev, apdev)
else: else:
res = t(dev) res = t(dev)
end = datetime.now()
diff = end - start
if res == "skip": if res == "skip":
skipped.append(name) skipped.append(name)
result = "SKIP" result = "SKIP"
else: else:
passed.append(name) passed.append(name)
result = "PASS" result = "PASS"
report(conn, args.build, args.commit, run, name, result, diff)
result = result + " " + name + " "
result = result + str(diff.total_seconds()) + " " + str(end)
logger.info(result)
if log_to_file or print_res:
print result
sys.stdout.flush()
except Exception, e: except Exception, e:
end = datetime.now()
diff = end - start
logger.info(e) logger.info(e)
result = "FAIL"
failed.append(name) failed.append(name)
report(conn, args.build, args.commit, run, name, "FAIL", diff)
result = "FAIL " + name + " " + str(diff.total_seconds()) + " " + str(end)
logger.info(result)
if log_to_file:
print result
sys.stdout.flush()
for d in dev: for d in dev:
try: try:
d.request("NOTE TEST-STOP " + name) d.request("NOTE TEST-STOP " + name)
@ -298,6 +282,16 @@ def main():
logger.info("Failed to rename log files") logger.info("Failed to rename log files")
logger.info(e) logger.info(e)
end = datetime.now()
diff = end - start
report(conn, args.build, args.commit, run, name, result, diff)
result = result + " " + name + " "
result = result + str(diff.total_seconds()) + " " + str(end)
logger.info(result)
if log_to_file or print_res:
print result
sys.stdout.flush()
if log_handler: if log_handler:
log_handler.stream.close() log_handler.stream.close()
logger.removeHandler(log_handler) logger.removeHandler(log_handler)