Browse Source

Exit with return value from benchmarker.run()

Hamilton Turner 11 years ago
parent
commit
67a6eb97eb
2 changed files with 12 additions and 5 deletions
  1. 11 4
      toolset/benchmark/benchmarker.py
  2. 1 1
      toolset/run-tests.py

+ 11 - 4
toolset/benchmark/benchmarker.py

@@ -515,12 +515,14 @@ class Benchmarker:
     logging.debug("Start __run_tests.")
     logging.debug("__name__ = %s",__name__)
 
+    error_happened = False
     if self.os.lower() == 'windows':
       logging.debug("Executing __run_tests on Windows")
       for test in tests:
         with open('current_benchmark.txt', 'w') as benchmark_resume_file:
           benchmark_resume_file.write(test.name)
-        self.__run_test(test)
+        if self.__run_test(test) != 0:
+          error_happened = True
     else:
       logging.debug("Executing __run_tests on Linux")
       # These features do not work on Windows
@@ -541,9 +543,14 @@ class Benchmarker:
             logging.debug("Child process for {name} is still alive. Terminating.".format(name=test.name))
             self.__write_intermediate_results(test.name,"__run_test timeout (="+ str(self.run_test_timeout_seconds) + " seconds)")
             test_process.terminate()
+          if test_process.exitcode != 0:
+            error_happened = True
+
     os.remove('current_benchmark.txt')
     logging.debug("End __run_tests.")
-
+    if error_happened:
+      return 1
+    return 0
   ############################################################
   # End __run_tests
   ############################################################
@@ -632,7 +639,7 @@ class Benchmarker:
             ---------------------------------------------------------
             """.format(name=test.name, port=str(test.port))) )
           err.flush()
-          return
+          return 1
 
         result = test.start(out, err)
         if result != 0: 
@@ -646,7 +653,7 @@ class Benchmarker:
             """.format(name=test.name)) )
           err.flush()
           self.__write_intermediate_results(test.name,"<setup.py>#start() returned non-zero")
-          return
+          return 1
         
         time.sleep(self.sleep)
 

+ 1 - 1
toolset/run-tests.py

@@ -158,7 +158,7 @@ def main(argv=None):
     elif benchmarker.parse != None:
       benchmarker.parse_timestamp()
     else:
-      benchmarker.run()
+      return benchmarker.run()
 
 if __name__ == "__main__":
     sys.exit(main())