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

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

Issue 1469833002: [test-runner] Move test case processing beyond the multi-process boundary. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Clean up + more comments Created 5 years, 1 month 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
Index: tools/testrunner/local/testsuite.py
diff --git a/tools/testrunner/local/testsuite.py b/tools/testrunner/local/testsuite.py
index dd654c30350ab404a7f85dcae9851017d211b51f..eccd98d0c711b35552ab059c63fbfd653d54cf63 100644
--- a/tools/testrunner/local/testsuite.py
+++ b/tools/testrunner/local/testsuite.py
@@ -88,21 +88,27 @@ class VariantGenerator(object):
class TestSuite(object):
@staticmethod
- def LoadTestSuite(root):
+ def LoadTestSuite(root, global_init=True):
name = root.split(os.path.sep)[-1]
f = None
try:
(f, pathname, description) = imp.find_module("testcfg", [root])
module = imp.load_module("testcfg", f, pathname, description)
- return module.GetSuite(name, root)
+ suite = module.GetSuite(name, root)
except ImportError:
# Use default if no testcfg is present.
- return GoogleTestSuite(name, root)
+ suite = GoogleTestSuite(name, root)
finally:
if f:
f.close()
+ if global_init:
+ suite.global_initialization()
+ return suite
def __init__(self, name, root):
+ # Note: This might be called concurrently from different processes. Global
+ # state (e.g. harddisk state) should be initialized in
+ # 'global_initialization' below.
self.name = name # string
self.root = root # string containing path
self.tests = None # list of TestCase objects
@@ -110,6 +116,12 @@ class TestSuite(object):
self.wildcards = None # dictionary mapping test paths to list of outcomes
self.total_duration = None # float, assigned on demand
+ def global_initialization(self):
Jakob Kummerow 2015/11/27 10:09:00 I'd keep the original LoadTestSuite and __init__ w
Michael Achenbach 2015/11/27 10:31:21 Method name ack. Regarding calling: I'll have to a
Jakob Kummerow 2015/11/27 10:34:41 Hm... that's a bit less elegant than I was hoping,
Michael Achenbach 2015/11/27 10:58:29 Done.
+ # This is called once per test suite object in a multi-process setting.
+ # Logic that is not multi-process-safe can go here, e.g. set up of a
+ # working directory for the suite.
+ pass
+
def shell(self):
return "d8"

Powered by Google App Engine
This is Rietveld 408576698