Commit 804cc9f3 authored by Michal Majewski's avatar Michal Majewski Committed by Commit Bot

[test] Remove context usage from test processors

Bug: v8:6917
Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: Id5a7b41502dfd4be43496b1edb958522a8eb0c31
Reviewed-on: https://chromium-review.googlesource.com/895588
Commit-Queue: Michał Majewski <majeski@google.com>
Reviewed-by: 's avatarSergiy Byelozyorov <sergiyb@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51023}
parent d81938ff
......@@ -39,7 +39,7 @@ class TestSuite(testsuite.TestSuite):
super(TestSuite, self).__init__(*args, **kwargs)
self.testroot = os.path.join(self.root, "data")
def ListTests(self, context):
def ListTests(self):
tests = map(self._create_test, [
"kraken/ai-astar",
"kraken/audio-beat-detection",
......
......@@ -37,7 +37,7 @@ SHELL = 'cctest'
class TestSuite(testsuite.TestSuite):
def ListTests(self, context):
def ListTests(self):
shell = os.path.abspath(os.path.join(self.test_config.shell_dir, SHELL))
if utils.IsWindows():
shell += ".exe"
......
......@@ -12,7 +12,7 @@ FILES_PATTERN = re.compile(r"//\s+Files:(.*)")
MODULE_PATTERN = re.compile(r"^// MODULE$", flags=re.MULTILINE)
class TestSuite(testsuite.TestSuite):
def ListTests(self, context):
def ListTests(self):
tests = []
for dirname, dirs, files in os.walk(self.root):
for dotted in [x for x in dirs if x.startswith('.')]:
......
......@@ -20,7 +20,7 @@ class TestSuite(testsuite.TestSuite):
'wasm_globals_section', 'wasm_imports_section', 'wasm_memory_section',
'wasm_names_section', 'wasm_types_section' )
def ListTests(self, context):
def ListTests(self):
tests = []
for subtest in TestSuite.SUB_TESTS:
for fname in os.listdir(os.path.join(self.root, subtest)):
......
......@@ -14,7 +14,7 @@ EXPECTED_SUFFIX = "-expected.txt"
RESOURCES_FOLDER = "resources"
class TestSuite(testsuite.TestSuite):
def ListTests(self, context):
def ListTests(self):
tests = []
for dirname, dirs, files in os.walk(
os.path.join(self.root), followlinks=True):
......
......@@ -31,7 +31,7 @@ from testrunner.local import testsuite
from testrunner.objects import testcase
class TestSuite(testsuite.TestSuite):
def ListTests(self, context):
def ListTests(self):
tests = []
for dirname, dirs, files in os.walk(self.root):
for dotted in [x for x in dirs if x.startswith('.')]:
......
......@@ -39,7 +39,7 @@ MODULE_PATTERN = re.compile(r"^// MODULE$", flags=re.MULTILINE)
class TestSuite(testsuite.TestSuite):
def ListTests(self, context):
def ListTests(self):
tests = []
for dirname, dirs, files in os.walk(self.root):
for dotted in [x for x in dirs if x.startswith('.')]:
......
......@@ -41,7 +41,7 @@ NO_HARNESS_PATTERN = re.compile(r"^// NO HARNESS$", flags=re.MULTILINE)
class TestSuite(testsuite.TestSuite):
def ListTests(self, context):
def ListTests(self):
tests = []
for dirname, dirs, files in os.walk(self.root, followlinks=True):
for dotted in [x for x in dirs if x.startswith('.')]:
......
......@@ -18,7 +18,7 @@ class TestSuite(testsuite.TestSuite):
v8_path = os.path.dirname(os.path.dirname(os.path.abspath(self.root)))
self.expected_path = os.path.join(v8_path, 'tools', 'v8heapconst.py')
def ListTests(self, context):
def ListTests(self):
test = self._create_test(SHELL)
return [test]
......
......@@ -60,7 +60,7 @@ class TestSuite(testsuite.TestSuite):
super(TestSuite, self).__init__(*args, **kwargs)
self.testroot = os.path.join(self.root, "data")
def ListTests(self, context):
def ListTests(self):
tests = []
for testdir in TEST_DIRS:
current_root = os.path.join(self.testroot, testdir)
......
......@@ -60,7 +60,7 @@ class TestSuite(testsuite.TestSuite):
return MkTest
execfile(pathname, {"Test": Test, "Template": Template})
def ListTests(self, context):
def ListTests(self):
result = []
# Find all .pyt files in this directory.
......
......@@ -158,7 +158,7 @@ class TestSuite(testsuite.TestSuite):
if f:
f.close()
def ListTests(self, context):
def ListTests(self):
testnames = set()
for dirname, dirs, files in itertools.chain(os.walk(self.testroot),
os.walk(self.localtestroot)):
......
......@@ -16,7 +16,7 @@ class VariantsGenerator(testsuite.VariantsGenerator):
class TestSuite(testsuite.TestSuite):
def ListTests(self, context):
def ListTests(self):
shell = os.path.abspath(os.path.join(self.test_config.shell_dir, self.name))
if utils.IsWindows():
shell += ".exe"
......
......@@ -8,7 +8,7 @@ from testrunner.local import testsuite
from testrunner.objects import testcase
class TestSuite(testsuite.TestSuite):
def ListTests(self, context):
def ListTests(self):
tests = []
for dirname, dirs, files in os.walk(self.root):
for dotted in [x for x in dirs if x.startswith('.')]:
......
......@@ -38,7 +38,7 @@ SELF_SCRIPT_PATTERN = re.compile(r"//\s+Env: TEST_FILE_NAME")
# TODO (machenbach): Share commonalities with mjstest.
class TestSuite(testsuite.TestSuite):
def ListTests(self, context):
def ListTests(self):
tests = []
for dirname, dirs, files in os.walk(self.root):
for dotted in [x for x in dirs if x.startswith('.')]:
......
......@@ -130,7 +130,7 @@ class TestSuite(object):
"""
self.suppress_internals = True
def ListTests(self, context):
def ListTests(self):
raise NotImplementedError
def _LegacyVariantsGeneratorFactory(self):
......@@ -171,8 +171,8 @@ class TestSuite(object):
def ReadStatusFile(self, variables):
self.statusfile = statusfile.StatusFile(self.status_file(), variables)
def ReadTestCases(self, context):
self.tests = self.ListTests(context)
def ReadTestCases(self):
self.tests = self.ListTests()
def FilterTestCasesByStatus(self,
......
......@@ -14,7 +14,6 @@ import base_runner
from testrunner.local import progress
from testrunner.local import utils
from testrunner.objects import context
from testrunner.testproc import fuzzer
from testrunner.testproc.base import TestProcProducer
......@@ -129,9 +128,8 @@ class NumFuzzer(base_runner.BaseTestRunner):
print(">>> Running tests for %s.%s" % (self.build_config.arch,
self.mode_name))
ctx = self._create_context(options)
self._setup_suites(options, suites)
tests = self._load_tests(options, suites, ctx)
tests = self._load_tests(options, suites)
progress_indicator = progress.IndicatorNotifier()
progress_indicator.Register(
progress.PROGRESS_INDICATORS[options.progress]())
......@@ -146,7 +144,7 @@ class NumFuzzer(base_runner.BaseTestRunner):
combiner = self._create_combiner(fuzzer_rng, options)
results = ResultsTracker()
execproc = ExecutionProc(options.j, ctx)
execproc = ExecutionProc(options.j)
indicators = progress_indicator.ToProgressIndicatorProcs()
procs = [
loader,
......@@ -185,25 +183,6 @@ class NumFuzzer(base_runner.BaseTestRunner):
return 2
return 0
def _create_context(self, options):
# Populate context object.
ctx = context.Context(self.build_config.arch,
self.mode_options.execution_mode,
self.outdir,
self.mode_options.flags, options.verbose,
options.timeout * self._timeout_scalefactor(options),
options.isolates,
options.command_prefix,
options.extra_flags,
False, # Keep i18n on by default.
True, # No sorting of test cases.
options.rerun_failures_count,
options.rerun_failures_max,
False, # No no_harness mode.
False, # Don't use perf data.
False) # Coverage not supported.
return ctx
def _setup_suites(self, options, suites):
"""Sets additional configurations on test suites based on options."""
if options.stress_interrupt_budget:
......@@ -211,7 +190,7 @@ class NumFuzzer(base_runner.BaseTestRunner):
for suite in suites:
suite.do_suppress_internals()
def _load_tests(self, options, suites, ctx):
def _load_tests(self, options, suites):
if options.combine_tests:
suites = [s for s in suites if s.test_combiner_available()]
......@@ -251,7 +230,7 @@ class NumFuzzer(base_runner.BaseTestRunner):
tests = []
for s in suites:
s.ReadStatusFile(variables)
s.ReadTestCases(ctx)
s.ReadTestCases()
tests += s.tests
return tests
......
......@@ -399,16 +399,15 @@ class StandardTestRunner(base_runner.BaseTestRunner):
if options.infra_staging:
for s in suites:
s.ReadStatusFile(variables)
s.ReadTestCases(ctx)
s.ReadTestCases()
return self._run_test_procs(suites, args, options, progress_indicator,
ctx)
return self._run_test_procs(suites, args, options, progress_indicator)
all_tests = []
num_tests = 0
for s in suites:
s.ReadStatusFile(variables)
s.ReadTestCases(ctx)
s.ReadTestCases()
if len(args) > 0:
s.FilterTestCasesByArgs(args)
all_tests += s.tests
......@@ -515,8 +514,7 @@ class StandardTestRunner(base_runner.BaseTestRunner):
count += 1
return shard
def _run_test_procs(self, suites, args, options, progress_indicator,
context):
def _run_test_procs(self, suites, args, options, progress_indicator):
jobs = options.j
print '>>> Running with test processors'
......@@ -528,7 +526,7 @@ class StandardTestRunner(base_runner.BaseTestRunner):
outproc_factory = None
if self.build_config.predictable:
outproc_factory = predictable.get_outproc
execproc = ExecutionProc(jobs, context, outproc_factory)
execproc = ExecutionProc(jobs, outproc_factory)
procs = [
loader,
......
......@@ -43,10 +43,9 @@ class ExecutionProc(base.TestProc):
sends results to the previous processor.
"""
def __init__(self, jobs, context, outproc_factory=None):
def __init__(self, jobs, outproc_factory=None):
super(ExecutionProc, self).__init__()
self._pool = pool.Pool(jobs)
self._context = context
self._outproc_factory = outproc_factory or (lambda t: t.output_proc)
self._tests = {}
......
......@@ -10,7 +10,7 @@ from testrunner.local import testsuite
from testrunner.objects import testcase
class TestSuite(testsuite.TestSuite):
def ListTests(self, context):
def ListTests(self):
return map(
self._create_test,
['bananas', 'apples', 'cherries', 'strawberries', 'raspberries'],
......
......@@ -10,7 +10,7 @@ from testrunner.local import testsuite
from testrunner.objects import testcase
class TestSuite(testsuite.TestSuite):
def ListTests(self, context):
def ListTests(self):
return map(
self._create_test,
['bananaflakes'],
......
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