Browse Source

Ensure we print a line at least once every 5 minutes in travis-CI

Hamilton Turner 10 years ago
parent
commit
363b90de56
1 changed files with 12 additions and 1 deletions
  1. 12 1
      toolset/benchmark/framework_test.py

+ 12 - 1
toolset/benchmark/framework_test.py

@@ -253,10 +253,13 @@ class FrameworkTest:
     nbsr = setup_util.NonBlockingStreamReader(p.stdout, 
       "%s: %s.sh and framework processes have terminated" % (self.name, self.setup_file))
 
-    # Setup a timeout
+    # Set a limit on total execution time of setup.sh
     timeout = datetime.now() + timedelta(minutes = 20)
     time_remaining = timeout - datetime.now()
 
+    # Need to print to stdout once every 10 minutes or Travis-CI will abort
+    travis_timeout = datetime.now() + timedelta(minutes = 5)
+
     # Flush output until setup.sh work is finished. This is 
     # either a) when setup.sh exits b) when the port is bound
     # c) when we run out of time. Note that 'finished' doesn't 
@@ -286,11 +289,19 @@ class FrameworkTest:
           line = nbsr.readline(0.05)
           if line:
             tee_output(prefix, line)
+
+            # Reset Travis-CI timer
+            travis_timeout = datetime.now() + timedelta(minutes = 5)
         except setup_util.EndOfStream:
           tee_output(prefix, "Setup has terminated\n")
           break
       time_remaining = timeout - datetime.now()
 
+      if (travis_timeout - datetime.now()).total_seconds() < 0:
+        sys.stdout.write(prefix + 'Printing so Travis-CI does not time out\n')
+        sys.stdout.flush()
+        travis_timeout = datetime.now() + timedelta(minutes = 5)
+
     # Did we time out?
     if time_remaining.total_seconds() < 0: 
       tee_output(prefix, "%s.sh timed out!! Aborting...\n" % self.setup_file)