diff options
author | 2016-07-25 11:42:07 +0000 | |
---|---|---|
committer | 2016-07-25 11:42:07 +0000 | |
commit | 0b94abfbb2173cf1a090e727a607045a33e75929 (patch) | |
tree | f78d92262b11469420fd4392d85d4221d3fd8ac6 /ci/run_tests.py | |
parent | a6e8b23db1d3106d790a506c8e8277b1e638ddbd (diff) | |
parent | 9ca917e17b6d04bce32cc420954aada538a60ddb (diff) |
Merge "Create a flag in the tests to indicate if they should be blocking or not"
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 0fb850130..cb05d435d 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() |