changeset fa66d9c5e180 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=fa66d9c5e180
description:
        tests: automatically kill regressions that take too long

        When GNU coreutils 'timeout' is available, limit each regression
        simulation to 4 hours.

diffstat:

 SConstruct       |   5 +++++
 tests/SConscript |  10 ++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diffs (49 lines):

diff -r b31580e27d1f -r fa66d9c5e180 SConstruct
--- a/SConstruct        Sat Sep 20 17:17:45 2014 -0400
+++ b/SConstruct        Mon Aug 25 14:32:00 2014 -0500
@@ -752,6 +752,11 @@
 swig_flags=Split('-c++ -python -modern -templatereduce $_CPPINCFLAGS')
 main.Append(SWIGFLAGS=swig_flags)
 
+# Check for 'timeout' from GNU coreutils.  If present, regressions
+# will be run with a time limit.
+TIMEOUT_version = readCommand(['timeout', '--version'], exception=False)
+main['TIMEOUT'] = TIMEOUT_version and TIMEOUT_version.find('timeout') == 0
+
 # filter out all existing swig scanners, they mess up the dependency
 # stuff for some reason
 scanners = []
diff -r b31580e27d1f -r fa66d9c5e180 tests/SConscript
--- a/tests/SConscript  Sat Sep 20 17:17:45 2014 -0400
+++ b/tests/SConscript  Mon Aug 25 14:32:00 2014 -0500
@@ -104,6 +104,10 @@
     timeout = 15 * 60 # used to be a param, probably should be again
     if env['BATCH']:
         cmd = '%s -t %d %s' % (env['BATCH_CMD'], timeout, cmd)
+    # The slowest regression (bzip2) requires ~2.8 hours;
+    # 4 hours was chosen to be conservative.
+    elif env['TIMEOUT']:
+        cmd = 'timeout 4h %s' % cmd
 
     # Create a default value for the status string, changed as needed
     # based on the status.
@@ -152,7 +156,9 @@
         # Consider it a failed test unless the exit status is 2
         status_str = "FAILED!"
         # gem5 did not terminate properly, so no need to check the output
-        if signaled(status):
+        if env['TIMEOUT'] and status == 124:
+            status_str = "TIMED-OUT!"
+        elif signaled(status):
             print 'gem5 terminated with signal', signum(status)
             if signum(status) in retry_signals:
                 # Consider the test incomplete; don't create a 'status' output.
@@ -192,7 +198,7 @@
 
     # if the test failed make it red, if it passed make it green, and
     # skip the punctuation
-    if status == "FAILED!":
+    if status == "FAILED!" or status == "TIMED-OUT!":
         status = termcap.Red + status[:-1] + termcap.Normal + status[-1]
     elif status == "CHANGED!":
         status = termcap.Yellow + status[:-1] + termcap.Normal + status[-1]
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to