Return -1 if copper test fails 99/17599/3
authorjose.lausuch <jose.lausuch@ericsson.com>
Wed, 27 Jul 2016 08:11:59 +0000 (10:11 +0200)
committerJose Lausuch <jose.lausuch@ericsson.com>
Wed, 27 Jul 2016 09:27:14 +0000 (09:27 +0000)
Change-Id: Ib66d1b69c73603bab33950ca2c0fca3f07eb3d22
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
ci/run_tests.py
testcases/features/copper.py

index f172eec..a024dd7 100755 (executable)
@@ -104,7 +104,6 @@ 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
index 7ab4e78..9efcbd7 100755 (executable)
 #\r
 \r
 import os\r
+import sys\r
 import time\r
-import yaml\r
-\r
 import functest.utils.functest_logger as ft_logger\r
 import functest.utils.functest_utils as functest_utils\r
+import yaml\r
+\r
 \r
 with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f:\r
     functest_yaml = yaml.safe_load(f)\r
@@ -38,11 +39,11 @@ def main():
 \r
     start_time = time.time()\r
 \r
-    ret = functest_utils.execute_command(cmd, logger, exit_on_error=False)\r
+    ret_val = functest_utils.execute_command(cmd, logger, exit_on_error=False)\r
 \r
     stop_time = time.time()\r
     duration = round(stop_time - start_time, 1)\r
-    if ret == 0:\r
+    if ret_val == 0:\r
         logger.info("COPPER PASSED")\r
         test_status = 'PASS'\r
     else:\r
@@ -76,6 +77,10 @@ def main():
                                       stop_time,\r
                                       details['status'],\r
                                       details)\r
+    if ret_val != 0:\r
+        sys.exit(-1)\r
+\r
+    sys.exit(0)\r
 \r
 if __name__ == '__main__':\r
     main()\r