Commit 430e03b3 authored by Michal Majewski's avatar Michal Majewski Committed by Commit Bot

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: 's avatarMichael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49417}
parent f576902c
...@@ -35,6 +35,7 @@ from testrunner.objects import testcase ...@@ -35,6 +35,7 @@ from testrunner.objects import testcase
class CcTestSuite(testsuite.TestSuite): class CcTestSuite(testsuite.TestSuite):
SHELL = 'cctest'
def __init__(self, name, root): def __init__(self, name, root):
super(CcTestSuite, self).__init__(name, root) super(CcTestSuite, self).__init__(name, root)
...@@ -44,7 +45,7 @@ class CcTestSuite(testsuite.TestSuite): ...@@ -44,7 +45,7 @@ class CcTestSuite(testsuite.TestSuite):
build_dir = "out" build_dir = "out"
def ListTests(self, context): 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(): if utils.IsWindows():
shell += ".exe" shell += ".exe"
cmd = context.command_prefix + [shell, "--list"] + context.extra_flags cmd = context.command_prefix + [shell, "--list"] + context.extra_flags
...@@ -61,12 +62,12 @@ class CcTestSuite(testsuite.TestSuite): ...@@ -61,12 +62,12 @@ class CcTestSuite(testsuite.TestSuite):
tests.sort(key=lambda t: t.path) tests.sort(key=lambda t: t.path)
return tests return tests
def GetShellForTestCase(self, testcase):
return self.SHELL
def GetParametersForTestCase(self, testcase, context): def GetParametersForTestCase(self, testcase, context):
return [testcase.path], testcase.flags + context.mode_flags, {} return [testcase.path], testcase.flags + context.mode_flags, {}
def shell(self):
return "cctest"
def GetSuite(name, root): def GetSuite(name, root):
return CcTestSuite(name, root) return CcTestSuite(name, root)
...@@ -30,16 +30,18 @@ class FuzzerTestSuite(testsuite.TestSuite): ...@@ -30,16 +30,18 @@ class FuzzerTestSuite(testsuite.TestSuite):
def ListTests(self, context): def ListTests(self, context):
tests = [] tests = []
for subtest in FuzzerTestSuite.SUB_TESTS: for subtest in FuzzerTestSuite.SUB_TESTS:
shell = 'v8_simple_%s_fuzzer' % subtest
for fname in os.listdir(os.path.join(self.root, subtest)): for fname in os.listdir(os.path.join(self.root, subtest)):
if not os.path.isfile(os.path.join(self.root, subtest, fname)): if not os.path.isfile(os.path.join(self.root, subtest, fname)):
continue continue
test = testcase.TestCase(self, '%s/%s' % (subtest, fname), test = testcase.TestCase(self, '%s/%s' % (subtest, fname))
override_shell=shell)
tests.append(test) tests.append(test)
tests.sort() tests.sort()
return tests return tests
def GetShellForTestCase(self, testcase):
group, _ = testcase.path.split('/', 1)
return 'v8_simple_%s_fuzzer' % group
def GetParametersForTestCase(self, testcase, context): def GetParametersForTestCase(self, testcase, context):
suite, name = testcase.path.split('/') suite, name = testcase.path.split('/')
return [os.path.join(self.root, suite, name)], [], {} return [os.path.join(self.root, suite, name)], [], {}
......
...@@ -17,7 +17,6 @@ EXPECTED_SUFFIX = "-expected.txt" ...@@ -17,7 +17,6 @@ EXPECTED_SUFFIX = "-expected.txt"
RESOURCES_FOLDER = "resources" RESOURCES_FOLDER = "resources"
class InspectorProtocolTestSuite(testsuite.TestSuite): class InspectorProtocolTestSuite(testsuite.TestSuite):
def __init__(self, name, root): def __init__(self, name, root):
super(InspectorProtocolTestSuite, self).__init__(name, root) super(InspectorProtocolTestSuite, self).__init__(name, root)
...@@ -39,6 +38,9 @@ class InspectorProtocolTestSuite(testsuite.TestSuite): ...@@ -39,6 +38,9 @@ class InspectorProtocolTestSuite(testsuite.TestSuite):
tests.append(test) tests.append(test)
return tests return tests
def GetShellForTestCase(self, testcase):
return 'inspector-test'
def GetParametersForTestCase(self, testcase, context): def GetParametersForTestCase(self, testcase, context):
source = self.GetSourceForTest(testcase) source = self.GetSourceForTest(testcase)
flags = testcase.flags + context.mode_flags flags = testcase.flags + context.mode_flags
...@@ -56,9 +58,6 @@ class InspectorProtocolTestSuite(testsuite.TestSuite): ...@@ -56,9 +58,6 @@ class InspectorProtocolTestSuite(testsuite.TestSuite):
with open(filename) as f: with open(filename) as f:
return f.read() return f.read()
def shell(self):
return "inspector-test"
def _IgnoreLine(self, string): def _IgnoreLine(self, string):
"""Ignore empty lines, valgrind output and Android output.""" """Ignore empty lines, valgrind output and Android output."""
if not string: return True if not string: return True
......
...@@ -10,14 +10,18 @@ from testrunner.objects import testcase ...@@ -10,14 +10,18 @@ from testrunner.objects import testcase
class MkGrokdump(testsuite.TestSuite): class MkGrokdump(testsuite.TestSuite):
SHELL = 'mkgrokdump'
def __init__(self, name, root): def __init__(self, name, root):
super(MkGrokdump, self).__init__(name, root) super(MkGrokdump, self).__init__(name, root)
def ListTests(self, context): def ListTests(self, context):
test = testcase.TestCase(self, self.shell()) test = testcase.TestCase(self, self.SHELL)
return [test] return [test]
def GetShellForTestCase(self, testcase):
return self.SHELL
def GetParametersForTestCase(self, testcase, context): def GetParametersForTestCase(self, testcase, context):
return [], [], {} return [], [], {}
...@@ -42,8 +46,5 @@ class MkGrokdump(testsuite.TestSuite): ...@@ -42,8 +46,5 @@ class MkGrokdump(testsuite.TestSuite):
return True return True
return False return False
def shell(self):
return "mkgrokdump"
def GetSuite(name, root): def GetSuite(name, root):
return MkGrokdump(name, root) return MkGrokdump(name, root)
...@@ -36,9 +36,6 @@ class PreparserTestSuite(testsuite.TestSuite): ...@@ -36,9 +36,6 @@ class PreparserTestSuite(testsuite.TestSuite):
def __init__(self, name, root): def __init__(self, name, root):
super(PreparserTestSuite, self).__init__(name, root) super(PreparserTestSuite, self).__init__(name, root)
def shell(self):
return "d8"
def _ParsePythonTestTemplates(self, result, filename): def _ParsePythonTestTemplates(self, result, filename):
pathname = os.path.join(self.root, filename + ".pyt") pathname = os.path.join(self.root, filename + ".pyt")
def Test(name, source, expectation, extra_flags=[]): def Test(name, source, expectation, extra_flags=[]):
......
...@@ -85,7 +85,7 @@ def MakeProcessContext(context, suite_names): ...@@ -85,7 +85,7 @@ def MakeProcessContext(context, suite_names):
def GetCommand(test, context): def GetCommand(test, context):
d8testflag = [] d8testflag = []
shell = test.shell() shell = test.suite.GetShellForTestCase(test)
if shell == "d8": if shell == "d8":
d8testflag = ["--test"] d8testflag = ["--test"]
if utils.IsWindows(): if utils.IsWindows():
...@@ -162,8 +162,9 @@ class TestJob(Job): ...@@ -162,8 +162,9 @@ class TestJob(Job):
failures). failures).
""" """
if context.sancov_dir and output.pid is not None: if context.sancov_dir and output.pid is not None:
shell = self.test.suite.GetShellForTestCase(self.test)
sancov_file = os.path.join( 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. # Some tests are expected to fail and don't produce coverage data.
if os.path.exists(sancov_file): if os.path.exists(sancov_file):
......
...@@ -375,7 +375,7 @@ class JsonTestProgressIndicator(ProgressIndicator): ...@@ -375,7 +375,7 @@ class JsonTestProgressIndicator(ProgressIndicator):
# TODO(machenbach): This stores only the global random seed from the # TODO(machenbach): This stores only the global random seed from the
# context and not possible overrides when using random-seed stress. # context and not possible overrides when using random-seed stress.
"random_seed": self.random_seed, "random_seed": self.random_seed,
"target_name": test.suite.shell(), "target_name": test.suite.GetShellForTestCase(test),
"variant": test.variant, "variant": test.variant,
}) })
......
...@@ -90,9 +90,6 @@ class TestSuite(object): ...@@ -90,9 +90,6 @@ class TestSuite(object):
self.wildcards = None # dictionary mapping test paths to list of outcomes self.wildcards = None # dictionary mapping test paths to list of outcomes
self.total_duration = None # float, assigned on demand self.total_duration = None # float, assigned on demand
def shell(self):
return "d8"
def suffix(self): def suffix(self):
return ".js" return ".js"
...@@ -257,6 +254,9 @@ class TestSuite(object): ...@@ -257,6 +254,9 @@ class TestSuite(object):
break break
self.tests = filtered self.tests = filtered
def GetShellForTestCase(self, testcase):
return 'd8'
def GetParametersForTestCase(self, testcase, context): def GetParametersForTestCase(self, testcase, context):
"""Returns a tuple of (files, flags, env) for this test case.""" """Returns a tuple of (files, flags, env) for this test case."""
raise NotImplementedError raise NotImplementedError
...@@ -313,7 +313,8 @@ class GoogleTestSuite(TestSuite): ...@@ -313,7 +313,8 @@ class GoogleTestSuite(TestSuite):
super(GoogleTestSuite, self).__init__(name, root) super(GoogleTestSuite, self).__init__(name, root)
def ListTests(self, context): 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(): if utils.IsWindows():
shell += ".exe" shell += ".exe"
...@@ -361,5 +362,5 @@ class GoogleTestSuite(TestSuite): ...@@ -361,5 +362,5 @@ class GoogleTestSuite(TestSuite):
def _VariantGeneratorFactory(self): def _VariantGeneratorFactory(self):
return StandardVariantGenerator return StandardVariantGenerator
def shell(self): def GetShellForTestCase(self, testcase):
return self.name return self.name
...@@ -27,13 +27,11 @@ ...@@ -27,13 +27,11 @@
class TestCase(object): class TestCase(object):
def __init__(self, suite, path, variant=None, flags=None, def __init__(self, suite, path, variant=None, flags=None):
override_shell=None):
self.suite = suite # TestSuite object self.suite = suite # TestSuite object
self.path = path # string, e.g. 'div-mod', 'test-api/foo' self.path = path # string, e.g. 'div-mod', 'test-api/foo'
self.flags = flags or [] # list of strings, flags specific to this test self.flags = flags or [] # list of strings, flags specific to this test
self.variant = variant # name of the used testing variant self.variant = variant # name of the used testing variant
self.override_shell = override_shell
self.outcomes = frozenset([]) self.outcomes = frozenset([])
self.output = None self.output = None
self.id = None # int, used to map result back to TestCase instance self.id = None # int, used to map result back to TestCase instance
...@@ -41,8 +39,7 @@ class TestCase(object): ...@@ -41,8 +39,7 @@ class TestCase(object):
self.run = 1 # The nth time this test is executed. self.run = 1 # The nth time this test is executed.
def CopyAddingFlags(self, variant, flags): def CopyAddingFlags(self, variant, flags):
copy = TestCase(self.suite, self.path, variant, self.flags + flags, copy = TestCase(self.suite, self.path, variant, self.flags + flags)
self.override_shell)
copy.outcomes = self.outcomes copy.outcomes = self.outcomes
return copy return copy
...@@ -55,11 +52,6 @@ class TestCase(object): ...@@ -55,11 +52,6 @@ class TestCase(object):
def GetLabel(self): def GetLabel(self):
return self.suitename() + "/" + self.suite.CommonTestName(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): def __getstate__(self):
"""Representation to pickle test cases. """Representation to pickle test cases.
......
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