Run tests sorted by expected runtime.

BUG=
R=jkummerow@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21328 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 0bfa1827
......@@ -31,6 +31,7 @@ import time
from pool import Pool
from . import commands
from . import perfdata
from . import utils
......@@ -59,7 +60,12 @@ def RunTest(job):
class Runner(object):
def __init__(self, suites, progress_indicator, context):
datapath = os.path.join("out", "testrunner_data")
self.perf_data_manager = perfdata.PerfDataManager(datapath)
self.perfdata = self.perf_data_manager.GetStore(context.arch, context.mode)
self.tests = [ t for s in suites for t in s.tests ]
for t in self.tests:
t.duration = self.perfdata.FetchPerfData(t) or 1.0
self._CommonInit(len(self.tests), progress_indicator, context)
def _CommonInit(self, num_tests, progress_indicator, context):
......@@ -88,7 +94,7 @@ class Runner(object):
# while the queue is filled.
queue = []
queued_exception = None
for test in self.tests:
for test in sorted(self.tests, key=lambda t: t.duration, reverse=True):
assert test.id >= 0
test_map[test.id] = test
try:
......@@ -124,6 +130,11 @@ class Runner(object):
else:
self.succeeded += 1
self.remaining -= 1
try:
self.perfdata.UpdatePerfData(test)
except Exception, e:
print("UpdatePerfData exception: %s" % e)
pass # Just keep working.
self.indicator.HasRun(test, has_unexpected_output)
finally:
pool.terminate()
......
......@@ -33,8 +33,8 @@ import threading
import time
from . import distro
from . import perfdata
from ..local import execution
from ..local import perfdata
from ..objects import peer
from ..objects import workpacket
from ..server import compression
......@@ -54,6 +54,8 @@ class NetworkedRunner(execution.Runner):
self.suites = suites
num_tests = 0
datapath = os.path.join("out", "testrunner_data")
# TODO(machenbach): These fields should exist now in the superclass.
# But there is no super constructor call. Check if this is a problem.
self.perf_data_manager = perfdata.PerfDataManager(datapath)
self.perfdata = self.perf_data_manager.GetStore(context.arch, context.mode)
for s in suites:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment