Bug 1083722 - Add jittest option to ignore timeouts from some tests r=sfink
authorJon Coppeard <jcoppeard@mozilla.com>
Mon, 20 Oct 2014 09:07:43 +0100
changeset 211205 e7f156e252529b6b9241f19dae67fee8909e8b70
parent 211204 5c097e67bdb02dd12e7a172334b9044ff7cb3eea
child 211206 f76047f574306287f4331ebb7ff4f90f3b81cba1
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerssfink
bugs1083722
milestone36.0a1
Bug 1083722 - Add jittest option to ignore timeouts from some tests r=sfink
js/src/jit-test/jit_test.py
js/src/tests/lib/jittests.py
--- a/js/src/jit-test/jit_test.py
+++ b/js/src/jit-test/jit_test.py
@@ -112,16 +112,18 @@ def main(argv):
                   type='string',
                   help='The location of libraries to push -- preferably stripped')
     op.add_option('--repeat', type=int, default=1,
                   help='Repeat tests the given number of times.')
     op.add_option('--this-chunk', type=int, default=1,
                   help='The test chunk to run.')
     op.add_option('--total-chunks', type=int, default=1,
                   help='The total number of test chunks.')
+    op.add_option('--ignore-timeouts', dest='ignore_timeouts', metavar='FILE',
+                  help='Ignore timeouts of tests listed in [FILE]')
 
     options, args = op.parse_args(argv)
     if len(args) < 1:
         op.error('missing JS_SHELL argument')
     # We need to make sure we are using backslashes on Windows.
     test_args = args[1:]
 
     if jittests.stdio_might_be_broken():
@@ -208,16 +210,26 @@ def main(argv):
     else:
         jitflags_list = jittests.parse_jitflags(options)
         for test in test_list:
             for jitflags in jitflags_list:
                 new_test = test.copy()
                 new_test.jitflags.extend(jitflags)
                 job_list.append(new_test)
 
+    if options.ignore_timeouts:
+        read_all = False
+        try:
+            with open(options.ignore_timeouts) as f:
+                options.ignore_timeouts = set([line.strip('\n') for line in f.readlines()])
+        except IOError:
+            sys.exit("Error reading file: " + options.ignore_timeouts)
+    else:
+        options.ignore_timeouts = set()
+
     prefix = [which(args[0])] + shlex.split(options.shell_args)
     prolog = os.path.join(jittests.LIB_DIR, 'prolog.js')
     if options.remote:
         prolog = posixpath.join(options.remote_test_root, 'jit-tests', 'jit-tests', 'lib', 'prolog.js')
 
     prefix += ['-f', prolog]
 
     # Clean up any remnants from previous crashes etc
--- a/js/src/tests/lib/jittests.py
+++ b/js/src/tests/lib/jittests.py
@@ -368,18 +368,21 @@ def run_test_remote(test, device, prefix
     returncode = device.shell(cmd, buf, env=env, cwd=options.remote_test_root,
                               timeout=int(options.timeout))
 
     out = buf.getvalue()
     # We can't distinguish between stdout and stderr so we pass
     # the same buffer to both.
     return TestOutput(test, cmd, out, out, returncode, None, False)
 
-def check_output(out, err, rc, timed_out, test):
+def check_output(out, err, rc, timed_out, test, options):
     if timed_out:
+        if test.relpath_tests in options.ignore_timeouts:
+            return True
+
         # The shell sometimes hangs on shutdown on Windows 7 and Windows
         # Server 2008. See bug 970063 comment 7 for a description of the
         # problem. Until bug 956899 is fixed, ignore timeouts on these
         # platforms (versions 6.0 and 6.1).
         if sys.platform == 'win32':
             ver = sys.getwindowsversion()
             if ver.major == 6 and ver.minor <= 1:
                 return True
@@ -647,17 +650,17 @@ def process_test_results(results, num_te
         for i, res in enumerate(results):
             if options.show_output:
                 sys.stdout.write(res.out)
                 sys.stdout.write(res.err)
                 sys.stdout.write('Exit code: %s\n' % res.rc)
             if res.test.valgrind:
                 sys.stdout.write(res.err)
 
-            ok = check_output(res.out, res.err, res.rc, res.timed_out, res.test)
+            ok = check_output(res.out, res.err, res.rc, res.timed_out, res.test, options)
             doing = 'after %s' % res.test.relpath_tests
             if not ok:
                 failures.append(res)
                 if res.timed_out:
                     pb.message("TIMEOUT - %s" % res.test.relpath_tests)
                     timeouts += 1
                 else:
                     pb.message("FAIL - %s" % res.test.relpath_tests)