Add flag to test harness to stop sorting test cases.
authormstarzinger@chromium.org <mstarzinger@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 28 May 2014 10:49:10 +0000 (10:49 +0000)
committermstarzinger@chromium.org <mstarzinger@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 28 May 2014 10:49:10 +0000 (10:49 +0000)
R=jkummerow@chromium.org, machenbach@chromium.org

Review URL: https://codereview.chromium.org/307553003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21561 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

tools/run-tests.py
tools/testrunner/local/execution.py
tools/testrunner/objects/context.py

index 5824f25..794c864 100755 (executable)
@@ -157,6 +157,9 @@ def BuildOptions():
   result.add_option("--no-snap", "--nosnap",
                     help='Test a build compiled without snapshot.',
                     default=False, dest="no_snap", action="store_true")
+  result.add_option("--no-sorting", "--nosorting",
+                    help="Don't sort tests according to duration of last run.",
+                    default=False, dest="no_sorting", action="store_true")
   result.add_option("--no-stress", "--nostress",
                     help="Don't run crankshaft --always-opt --stress-op test",
                     default=False, dest="no_stress", action="store_true")
@@ -411,7 +414,8 @@ def Execute(arch, mode, args, options, suites, workspace):
                         options.command_prefix,
                         options.extra_flags,
                         options.no_i18n,
-                        options.random_seed)
+                        options.random_seed,
+                        options.no_sorting)
 
   # TODO(all): Combine "simulator" and "simulator_run".
   simulator_run = not options.dont_skip_simulator_slow_tests and \
index 4dc62c2..80a5989 100644 (file)
@@ -94,7 +94,9 @@ class Runner(object):
     # while the queue is filled.
     queue = []
     queued_exception = None
-    for test in sorted(self.tests, key=lambda t: t.duration, reverse=True):
+    if not self.context.no_sorting:
+      self.tests = sorted(self.tests, key=lambda t: t.duration, reverse=True)
+    for test in self.tests:
       assert test.id >= 0
       test_map[test.id] = test
       try:
index 68c1989..f8f764b 100644 (file)
@@ -28,7 +28,8 @@
 
 class Context():
   def __init__(self, arch, mode, shell_dir, mode_flags, verbose, timeout,
-               isolates, command_prefix, extra_flags, noi18n, random_seed):
+               isolates, command_prefix, extra_flags, noi18n, random_seed,
+               no_sorting):
     self.arch = arch
     self.mode = mode
     self.shell_dir = shell_dir
@@ -40,15 +41,16 @@ class Context():
     self.extra_flags = extra_flags
     self.noi18n = noi18n
     self.random_seed = random_seed
+    self.no_sorting = no_sorting
 
   def Pack(self):
     return [self.arch, self.mode, self.mode_flags, self.timeout, self.isolates,
             self.command_prefix, self.extra_flags, self.noi18n,
-            self.random_seed]
+            self.random_seed, self.no_sorting]
 
   @staticmethod
   def Unpack(packed):
     # For the order of the fields, refer to Pack() above.
     return Context(packed[0], packed[1], None, packed[2], False,
                    packed[3], packed[4], packed[5], packed[6], packed[7],
-                   packed[8])
+                   packed[8], packed[9])