Browse Source

remove tmp directory when running continuously (#2298)

A Shawn Bandy 8 years ago
parent
commit
59e3ed3eca
3 changed files with 16 additions and 1 deletions
  1. 14 0
      toolset/benchmark/benchmarker.py
  2. 1 1
      toolset/run-continuously.sh
  3. 1 0
      toolset/run-tests.py

+ 14 - 0
toolset/benchmark/benchmarker.py

@@ -649,6 +649,20 @@ class Benchmarker:
         out.flush()
         time.sleep(5)
 
+        ##########################################################
+        # Remove contents of  /tmp folder
+        ##########################################################
+        if self.clear_tmp:
+          try:
+            filelist = [ f for f in os.listdir("/tmp") ]
+            for f in filelist:
+              try:
+                os.remove("/tmp/" + f)
+              except OSError as err:
+                print "Failed to remove " + str(f) + " from /tmp directory: " + str(err)
+          except OSError:
+            print "Failed to remove contents of /tmp directory."
+
         ##########################################################
         # Save results thus far into the latest results directory
         ##########################################################

+ 1 - 1
toolset/run-continuously.sh

@@ -44,7 +44,7 @@ do
   echo Change to benchmark root
   cd $TFB_REPOPARENT/$TFB_REPONAME
   echo Run tests
-  toolset/run-tests.py
+  toolset/run-tests.py --clear-tmp
   # Handle any postprocessing
   echo Running post-test tasks
   for SCRIPT in $TFB_REPOPARENT/$TFB_REPONAME/toolset/lifecycle/post-run-tests/*

+ 1 - 0
toolset/run-tests.py

@@ -170,6 +170,7 @@ def main(argv=None):
     # Misc Options
     parser.add_argument('--parse', help='Parses the results of the given timestamp and merges that with the latest results')
     parser.add_argument('-v', '--verbose', action='store_true', default=False, help='Causes the configuration to print before any other commands are executed.')
+    parser.add_argument('--clear-tmp', action='store_true', default=False, help='Clears files written to /tmp after each framework\'s tests complete.')
     parser.set_defaults(**defaults) # Must do this after add, or each option's default will override the configuration file default
     args = parser.parse_args(remaining_argv)