[test] Load the same suites in sub and parent test processes

Before this fix, all existing suites would get wastefully initialized in each subprocess.

Bug: v8:6375
Change-Id: I68d961cde143754724735aecbac605852f89c7d9
Reviewed-on: https://chromium-review.googlesource.com/500187
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45188}
This commit is contained in:
Michael Achenbach 2017-05-09 10:44:01 +02:00 committed by Commit Bot
parent e77ae92738
commit dfddbd2d2a

View File

@ -62,17 +62,18 @@ ProcessContext = collections.namedtuple(
"process_context", ["suites", "context"])
def MakeProcessContext(context):
def MakeProcessContext(context, suite_names):
"""Generate a process-local context.
This reloads all suites per process and stores the global context.
Args:
context: The global context from the test runner.
suite_names (list of str): Suite names as loaded by the parent process.
Load the same suites in each subprocess.
"""
suite_paths = utils.GetSuitePaths(TEST_DIR)
suites = {}
for root in suite_paths:
for root in suite_names:
# Don't reinitialize global state as this is concurrently called from
# different processes.
suite = testsuite.TestSuite.LoadTestSuite(
@ -198,7 +199,8 @@ class Runner(object):
self.perfdata = self.perf_data_manager.GetStore(context.arch, context.mode)
self.perf_failures = False
self.printed_allocations = False
self.tests = [ t for s in suites for t in s.tests ]
self.tests = [t for s in suites for t in s.tests]
self.suite_names = [s.name for s in suites]
# Always pre-sort by status file, slowest tests first.
slow_key = lambda t: statusfile.IsSlow(t.outcomes)
@ -353,7 +355,7 @@ class Runner(object):
fn=RunTest,
gen=gen_tests(),
process_context_fn=MakeProcessContext,
process_context_args=[self.context],
process_context_args=[self.context, self.suite_names],
)
for result in it:
if result.heartbeat: