Chromium Code Reviews| 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" |