Commit dfddbd2d authored by Michael Achenbach's avatar Michael Achenbach Committed by Commit Bot

[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/500187Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45188}
parent e77ae927
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment