Browse Source

fix current_benchmark location

Nate Brady 8 years ago
parent
commit
6f24f07a82
1 changed files with 9 additions and 6 deletions
  1. 9 6
      toolset/benchmark/benchmarker.py

+ 9 - 6
toolset/benchmark/benchmarker.py

@@ -319,8 +319,8 @@ class Benchmarker:
 
     # If the tests have been interrupted somehow, then we want to resume them where we left
     # off, rather than starting from the beginning
-    if os.path.isfile('current_benchmark.txt'):
-        with open('current_benchmark.txt', 'r') as interrupted_benchmark:
+    if os.path.isfile(self.current_benchmark):
+        with open(self.current_benchmark, 'r') as interrupted_benchmark:
             interrupt_bench = interrupted_benchmark.read().strip()
             for index, atest in enumerate(tests):
                 if atest.name == interrupt_bench:
@@ -441,7 +441,7 @@ class Benchmarker:
     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:
+        with open(self.current_benchmark, 'w') as benchmark_resume_file:
           benchmark_resume_file.write(test.name)
         if self.__run_test(test) != 0:
           error_happened = True
@@ -461,7 +461,7 @@ class Benchmarker:
         pbar_test = pbar_test + 1
         if __name__ == 'benchmark.benchmarker':
           print header("Running Test: %s" % test.name)
-          with open('current_benchmark.txt', 'w') as benchmark_resume_file:
+          with open(self.current_benchmark, 'w') as benchmark_resume_file:
             benchmark_resume_file.write(test.name)
           test_process = Process(target=self.__run_test, name="Test Runner (%s)" % test.name, args=(test,))
           test_process.start()
@@ -475,8 +475,8 @@ class Benchmarker:
           if test_process.exitcode != 0:
             error_happened = True
       pbar.finish()
-    if os.path.isfile('current_benchmark.txt'):
-      os.remove('current_benchmark.txt')
+    if os.path.isfile(self.current_benchmark):
+      os.remove(self.current_benchmark)
     logging.debug("End __run_tests.")
 
     if error_happened:
@@ -986,6 +986,9 @@ class Benchmarker:
     # Remember root directory
     self.fwroot = setup_util.get_fwroot()
 
+    # setup current_benchmark.txt location
+    self.current_benchmark = os.path.join(self.fwroot, "tmp/current_benchmark.txt")
+
     # setup results and latest_results directories
     self.result_directory = os.path.join(self.fwroot, "results")
     self.logs_directory = os.path.join(self.fwroot, "logs")