From 743e07bad0fd3751dbe4425221f2422917a756bb Mon Sep 17 00:00:00 2001 From: "machenbach@chromium.org" Date: Thu, 15 May 2014 12:01:34 +0000 Subject: [PATCH] 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 --- tools/testrunner/local/execution.py | 13 ++++++++++++- tools/testrunner/{network => local}/perfdata.py | 0 tools/testrunner/network/network_execution.py | 4 +++- 3 files changed, 15 insertions(+), 2 deletions(-) rename tools/testrunner/{network => local}/perfdata.py (100%) diff --git a/tools/testrunner/local/execution.py b/tools/testrunner/local/execution.py index 80d881b..c095ea6 100644 --- a/tools/testrunner/local/execution.py +++ b/tools/testrunner/local/execution.py @@ -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() diff --git a/tools/testrunner/network/perfdata.py b/tools/testrunner/local/perfdata.py similarity index 100% rename from tools/testrunner/network/perfdata.py rename to tools/testrunner/local/perfdata.py diff --git a/tools/testrunner/network/network_execution.py b/tools/testrunner/network/network_execution.py index 0f53a6b..a43a6cf 100644 --- a/tools/testrunner/network/network_execution.py +++ b/tools/testrunner/network/network_execution.py @@ -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: -- 2.7.4