[PATCH 1/2] hwsim tests: refactor test results reporting
Johannes Berg
johannes
Thu Oct 31 07:02:50 PDT 2013
From: Johannes Berg <johannes.berg at intel.com>
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 at intel.com>
---
tests/hwsim/run-tests.py | 28 +++++++++++-----------------
1 file changed, 11 insertions(+), 17 deletions(-)
diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py
index 5b2f884..b40c971 100755
--- a/tests/hwsim/run-tests.py
+++ b/tests/hwsim/run-tests.py
@@ -245,32 +245,16 @@ def main():
res = t(dev, apdev)
else:
res = t(dev)
- end = datetime.now()
- diff = end - start
if res == "skip":
skipped.append(name)
result = "SKIP"
else:
passed.append(name)
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:
- end = datetime.now()
- diff = end - start
logger.info(e)
+ result = "FAIL"
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:
try:
d.request("NOTE TEST-STOP " + name)
@@ -296,6 +280,16 @@ def main():
logger.info("Failed to rename log files")
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:
log_handler.stream.close()
logger.removeHandler(log_handler)
--
1.8.4.rc3
More information about the Hostap
mailing list