Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Unified Diff: tools/testrunner/local/execution.py

Issue 1174923002: [test] Use generator to accelerate test runner startup. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testrunner/local/execution.py
diff --git a/tools/testrunner/local/execution.py b/tools/testrunner/local/execution.py
index 2b2f876d24f06a421853e41d24f2ab1be6d5acca..d3f83eae3c8b1bc2aaae4fb2d725a3cd4fe646da 100644
--- a/tools/testrunner/local/execution.py
+++ b/tools/testrunner/local/execution.py
@@ -214,23 +214,20 @@ class Runner(object):
def _RunInternal(self, jobs):
pool = Pool(jobs)
test_map = {}
- # TODO(machenbach): Instead of filling the queue completely before
- # pool.imap_unordered, make this a generator that already starts testing
- # while the queue is filled.
- queue = []
- queued_exception = None
- for test in self.tests:
- assert test.id >= 0
- test_map[test.id] = test
- try:
- queue.append([self._GetJob(test)])
- except Exception, e:
- # If this failed, save the exception and re-raise it later (after
- # all other tests have had a chance to run).
- queued_exception = e
- continue
+ queued_exception = [None]
+ def gen_tests():
+ for test in self.tests:
+ assert test.id >= 0
+ test_map[test.id] = test
+ try:
+ yield [self._GetJob(test)]
+ except Exception, e:
+ # If this failed, save the exception and re-raise it later (after
+ # all other tests have had a chance to run).
+ queued_exception[0] = e
+ continue
try:
- it = pool.imap_unordered(RunTest, queue)
+ it = pool.imap_unordered(RunTest, gen_tests())
for result in it:
if result.heartbeat:
self.indicator.Heartbeat()
@@ -252,8 +249,8 @@ class Runner(object):
# some files might still be open.
print "Deleting perf test data due to db corruption."
shutil.rmtree(self.datapath)
- if queued_exception:
- raise queued_exception
+ if queued_exception[0]:
+ raise queued_exception[0]
# Make sure that any allocations were printed in predictable mode (if we
# ran any tests).
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698