X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=ci%2Frun_tests.py;h=982567217fa97d03bb45ddd7c629452f4f52f872;hb=53fd052b7fce64294c50ca170d42367d711ccc3f;hp=f172eecc67d2214ec5f9361654ed87b7c07141e8;hpb=534a6b4990081a8c21f9af912967fba195922e71;p=functest.git diff --git a/ci/run_tests.py b/ci/run_tests.py index f172eecc6..982567217 100755 --- a/ci/run_tests.py +++ b/ci/run_tests.py @@ -75,6 +75,13 @@ def cleanup(): os_clean.main() +def update_test_info(test_name, result, duration): + for test in EXECUTED_TEST_CASES: + if test['test_name'] == test_name: + test.update({"result": result, + "duration": duration}) + + def run_test(test, tier_name): global OVERALL_RESULT, EXECUTED_TEST_CASES result_str = "PASS" @@ -95,7 +102,7 @@ def run_test(test, tier_name): cmd = ("%s%s" % (EXEC_SCRIPT, flags)) logger.debug("Executing command '%s'" % cmd) - result = ft_utils.execute_command(cmd, logger, exit_on_error=False) + result = ft_utils.execute_command(cmd, exit_on_error=False) if CLEAN_FLAG: cleanup() @@ -104,22 +111,22 @@ def run_test(test, tier_name): duration_str = ("%02d:%02d" % divmod(duration, 60)) logger.info("Test execution time: %s" % duration_str) - result = 0 if result != 0: logger.error("The test case '%s' failed. " % test_name) OVERALL_RESULT = -1 result_str = "FAIL" - if test.get_blocking(): - logger.info("This test case is blocking. Exiting...") + if test.is_blocking(): + if not args.test or args.test == "all": + logger.info("This test case is blocking. Aborting overall " + "execution.") + # if it is a single test we don't print the whole results table + update_test_info(test_name, result_str, duration_str) + generate_report.main(EXECUTED_TEST_CASES) + logger.info("Execution exit value: %s" % OVERALL_RESULT) sys.exit(OVERALL_RESULT) - for test in EXECUTED_TEST_CASES: - if test['test_name'] == test_name: - test.update({"result": result_str, - "duration": duration_str}) - - return result + update_test_info(test_name, result_str, duration_str) def run_tier(tier): @@ -135,11 +142,7 @@ def run_tier(tier): print_separator("#") logger.debug("\n%s" % tier) for test in tests: - res = run_test(test, tier_name) - if res != 0: - return res - - return 0 + run_test(test, tier_name) def run_all(tiers): @@ -164,12 +167,9 @@ def run_all(tiers): logger.info("Tests to be executed:%s" % summary) EXECUTED_TEST_CASES = generate_report.init(tiers_to_run) for tier in tiers_to_run: - res = run_tier(tier) - if res != 0: - return res - generate_report.main(EXECUTED_TEST_CASES) + run_tier(tier) - return 0 + generate_report.main(EXECUTED_TEST_CASES) def main(): @@ -208,6 +208,7 @@ def main(): else: run_all(_tiers) + logger.info("Execution exit value: %s" % OVERALL_RESULT) sys.exit(OVERALL_RESULT) if __name__ == '__main__':