Remove shell info from testcase.

Bug: v8:6917
Change-Id: Ic50ed8aca2ef6b6e60eae194cf46c2264a416657
Reviewed-on: https://chromium-review.googlesource.com/774265
Commit-Queue: Michał Majewski <majeski@google.com>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49417}
This commit is contained in:
Michal Majewski 2017-11-16 16:31:43 +01:00 committed by Commit Bot
parent f576902c99
commit 430e03b3c6
9 changed files with 30 additions and 36 deletions

View File

@ -35,6 +35,7 @@ from testrunner.objects import testcase
class CcTestSuite(testsuite.TestSuite):
SHELL = 'cctest'
def __init__(self, name, root):
super(CcTestSuite, self).__init__(name, root)
@ -44,7 +45,7 @@ class CcTestSuite(testsuite.TestSuite):
build_dir = "out"
def ListTests(self, context):
shell = os.path.abspath(os.path.join(context.shell_dir, self.shell()))
shell = os.path.abspath(os.path.join(context.shell_dir, self.SHELL))
if utils.IsWindows():
shell += ".exe"
cmd = context.command_prefix + [shell, "--list"] + context.extra_flags
@ -61,12 +62,12 @@ class CcTestSuite(testsuite.TestSuite):
tests.sort(key=lambda t: t.path)
return tests
def GetShellForTestCase(self, testcase):
return self.SHELL
def GetParametersForTestCase(self, testcase, context):
return [testcase.path], testcase.flags + context.mode_flags, {}
def shell(self):
return "cctest"
def GetSuite(name, root):
return CcTestSuite(name, root)

View File

@ -30,16 +30,18 @@ class FuzzerTestSuite(testsuite.TestSuite):
def ListTests(self, context):
tests = []
for subtest in FuzzerTestSuite.SUB_TESTS:
shell = 'v8_simple_%s_fuzzer' % subtest
for fname in os.listdir(os.path.join(self.root, subtest)):
if not os.path.isfile(os.path.join(self.root, subtest, fname)):
continue
test = testcase.TestCase(self, '%s/%s' % (subtest, fname),
override_shell=shell)
test = testcase.TestCase(self, '%s/%s' % (subtest, fname))
tests.append(test)
tests.sort()
return tests
def GetShellForTestCase(self, testcase):
group, _ = testcase.path.split('/', 1)
return 'v8_simple_%s_fuzzer' % group
def GetParametersForTestCase(self, testcase, context):
suite, name = testcase.path.split('/')
return [os.path.join(self.root, suite, name)], [], {}

View File

@ -17,7 +17,6 @@ EXPECTED_SUFFIX = "-expected.txt"
RESOURCES_FOLDER = "resources"
class InspectorProtocolTestSuite(testsuite.TestSuite):
def __init__(self, name, root):
super(InspectorProtocolTestSuite, self).__init__(name, root)
@ -39,6 +38,9 @@ class InspectorProtocolTestSuite(testsuite.TestSuite):
tests.append(test)
return tests
def GetShellForTestCase(self, testcase):
return 'inspector-test'
def GetParametersForTestCase(self, testcase, context):
source = self.GetSourceForTest(testcase)
flags = testcase.flags + context.mode_flags
@ -56,9 +58,6 @@ class InspectorProtocolTestSuite(testsuite.TestSuite):
with open(filename) as f:
return f.read()
def shell(self):
return "inspector-test"
def _IgnoreLine(self, string):
"""Ignore empty lines, valgrind output and Android output."""
if not string: return True

View File

@ -10,14 +10,18 @@ from testrunner.objects import testcase
class MkGrokdump(testsuite.TestSuite):
SHELL = 'mkgrokdump'
def __init__(self, name, root):
super(MkGrokdump, self).__init__(name, root)
def ListTests(self, context):
test = testcase.TestCase(self, self.shell())
test = testcase.TestCase(self, self.SHELL)
return [test]
def GetShellForTestCase(self, testcase):
return self.SHELL
def GetParametersForTestCase(self, testcase, context):
return [], [], {}
@ -42,8 +46,5 @@ class MkGrokdump(testsuite.TestSuite):
return True
return False
def shell(self):
return "mkgrokdump"
def GetSuite(name, root):
return MkGrokdump(name, root)

View File

@ -36,9 +36,6 @@ class PreparserTestSuite(testsuite.TestSuite):
def __init__(self, name, root):
super(PreparserTestSuite, self).__init__(name, root)
def shell(self):
return "d8"
def _ParsePythonTestTemplates(self, result, filename):
pathname = os.path.join(self.root, filename + ".pyt")
def Test(name, source, expectation, extra_flags=[]):

View File

@ -85,7 +85,7 @@ def MakeProcessContext(context, suite_names):
def GetCommand(test, context):
d8testflag = []
shell = test.shell()
shell = test.suite.GetShellForTestCase(test)
if shell == "d8":
d8testflag = ["--test"]
if utils.IsWindows():
@ -162,8 +162,9 @@ class TestJob(Job):
failures).
"""
if context.sancov_dir and output.pid is not None:
shell = self.test.suite.GetShellForTestCase(self.test)
sancov_file = os.path.join(
context.sancov_dir, "%s.%d.sancov" % (self.test.shell(), output.pid))
context.sancov_dir, "%s.%d.sancov" % (shell, output.pid))
# Some tests are expected to fail and don't produce coverage data.
if os.path.exists(sancov_file):

View File

@ -375,7 +375,7 @@ class JsonTestProgressIndicator(ProgressIndicator):
# TODO(machenbach): This stores only the global random seed from the
# context and not possible overrides when using random-seed stress.
"random_seed": self.random_seed,
"target_name": test.suite.shell(),
"target_name": test.suite.GetShellForTestCase(test),
"variant": test.variant,
})

View File

@ -90,9 +90,6 @@ class TestSuite(object):
self.wildcards = None # dictionary mapping test paths to list of outcomes
self.total_duration = None # float, assigned on demand
def shell(self):
return "d8"
def suffix(self):
return ".js"
@ -257,6 +254,9 @@ class TestSuite(object):
break
self.tests = filtered
def GetShellForTestCase(self, testcase):
return 'd8'
def GetParametersForTestCase(self, testcase, context):
"""Returns a tuple of (files, flags, env) for this test case."""
raise NotImplementedError
@ -313,7 +313,8 @@ class GoogleTestSuite(TestSuite):
super(GoogleTestSuite, self).__init__(name, root)
def ListTests(self, context):
shell = os.path.abspath(os.path.join(context.shell_dir, self.shell()))
shell = os.path.abspath(
os.path.join(context.shell_dir, self.GetShellForTestCase(None)))
if utils.IsWindows():
shell += ".exe"
@ -361,5 +362,5 @@ class GoogleTestSuite(TestSuite):
def _VariantGeneratorFactory(self):
return StandardVariantGenerator
def shell(self):
def GetShellForTestCase(self, testcase):
return self.name

View File

@ -27,13 +27,11 @@
class TestCase(object):
def __init__(self, suite, path, variant=None, flags=None,
override_shell=None):
def __init__(self, suite, path, variant=None, flags=None):
self.suite = suite # TestSuite object
self.path = path # string, e.g. 'div-mod', 'test-api/foo'
self.flags = flags or [] # list of strings, flags specific to this test
self.variant = variant # name of the used testing variant
self.override_shell = override_shell
self.outcomes = frozenset([])
self.output = None
self.id = None # int, used to map result back to TestCase instance
@ -41,8 +39,7 @@ class TestCase(object):
self.run = 1 # The nth time this test is executed.
def CopyAddingFlags(self, variant, flags):
copy = TestCase(self.suite, self.path, variant, self.flags + flags,
self.override_shell)
copy = TestCase(self.suite, self.path, variant, self.flags + flags)
copy.outcomes = self.outcomes
return copy
@ -55,11 +52,6 @@ class TestCase(object):
def GetLabel(self):
return self.suitename() + "/" + self.suite.CommonTestName(self)
def shell(self):
if self.override_shell:
return self.override_shell
return self.suite.shell()
def __getstate__(self):
"""Representation to pickle test cases.