From 0d84c400f92d84f5c393ac54309df1d7b61073c8 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 29 Sep 2013 16:21:42 +0300 Subject: [PATCH] tests: Add mechanism for test cases to indicate a skipped run This can be used by test cases that depend on some external component that may not always be available to indicate clearly that a test case was skipped rather than passed or failed. Signed-hostap: Jouni Malinen --- tests/hwsim/run-tests.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py index 38efda0f7..415198a7f 100755 --- a/tests/hwsim/run-tests.py +++ b/tests/hwsim/run-tests.py @@ -103,6 +103,7 @@ def main(): logger.info("APDEV: " + ap['ifname']) passed = [] + skipped = [] failed = [] for t in tests: @@ -124,13 +125,19 @@ def main(): logger.info(e) try: if t.func_code.co_argcount > 1: - t(dev, apdev) + res = t(dev, apdev) else: - t(dev) - passed.append(t.__name__) + res = t(dev) end = datetime.now() diff = end - start - result = "PASS " + t.__name__ + " " + str(diff.total_seconds()) + " " + str(end) + if res == "skip": + skipped.append(t.__name__) + result = "SKIP " + else: + passed.append(t.__name__) + result = "PASS " + result = result + t.__name__ + " " + result = result + str(diff.total_seconds()) + " " + str(end) logger.info(result) if log_file or print_res: print result @@ -163,6 +170,7 @@ def main(): if len(failed): logger.info("passed " + str(len(passed)) + " test case(s)") + logger.info("skipped " + str(len(skipped)) + " test case(s)") logger.info("failed tests: " + str(failed)) if error_file: f = open(error_file, 'w') @@ -170,8 +178,12 @@ def main(): f.close() sys.exit(1) logger.info("passed all " + str(len(passed)) + " test case(s)") + if len(skipped): + logger.info("skipped " + str(len(skipped)) + " test case(s)") if log_file: print "passed all " + str(len(passed)) + " test case(s)" + if len(skipped): + print "skipped " + str(len(skipped)) + " test case(s)" if __name__ == "__main__": main()