diff options
author | jose.lausuch <jose.lausuch@ericsson.com> | 2016-07-25 11:43:01 +0200 |
---|---|---|
committer | jose.lausuch <jose.lausuch@ericsson.com> | 2016-07-25 12:10:07 +0200 |
commit | 9ca917e17b6d04bce32cc420954aada538a60ddb (patch) | |
tree | f5e49200e37186a5947edb19da2a34e00fcf5445 /ci/run_tests.py | |
parent | 0f6c6171d514f6f7c3cb376bd40f20468a37bc41 (diff) |
Create a flag in the tests to indicate if they should be blocking or not
JIRA: FUNCTEST-380
Change-Id: I737d71a47ddac80bf0222a1f004af05f509c5971
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'ci/run_tests.py')
-rwxr-xr-x | ci/run_tests.py | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/ci/run_tests.py b/ci/run_tests.py index 0fb85013..cb05d435 100755 --- a/ci/run_tests.py +++ b/ci/run_tests.py @@ -45,6 +45,10 @@ EXEC_SCRIPT = ("%sci/exec_test.sh" % FUNCTEST_REPO) CLEAN_FLAG = True REPORT_FLAG = False +# This will be the return code of this script. If any of the tests fails, +# this variable will change to -1 +OVERALL_RESULT = 0 + def print_separator(str, count=45): line = "" @@ -71,6 +75,7 @@ def cleanup(): def run_test(test): + global OVERALL_RESULT start = datetime.datetime.now() test_name = test.get_name() logger.info("\n") # blank line @@ -91,20 +96,24 @@ def run_test(test): result = ft_utils.execute_command(cmd, logger, exit_on_error=False) - if result != 0: - logger.error("The test case '%s' failed. Cleaning and exiting." - % test_name) - if CLEAN_FLAG: - cleanup() - sys.exit(1) - if CLEAN_FLAG: cleanup() + end = datetime.datetime.now() duration = (end - start).seconds str = ("%02d:%02d" % divmod(duration, 60)) logger.info("Test execution time: %s" % str) + if result != 0: + logger.error("The test case '%s' failed. " % test_name) + OVERALL_RESULT = -1 + + if test.get_blocking(): + logger.info("This test case is blocking. Exiting...") + sys.exit(OVERALL_RESULT) + + return result + def run_tier(tier): tests = tier.get_tests() @@ -181,7 +190,7 @@ def main(): else: run_all(_tiers) - sys.exit(0) + sys.exit(OVERALL_RESULT) if __name__ == '__main__': main() |