Commit 0a12eaea authored by Michal Majewski's avatar Michal Majewski Committed by Commit Bot

Remove env field from testcase.

Bug: v8:6917
Cq-Include-Trybots: master.tryserver.v8:v8_linux_noi18n_rel_ng
Change-Id: I09fb05ac6d4b9b1223118494ce2c89e3ab5de109
Reviewed-on: https://chromium-review.googlesource.com/771870Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Michał Majewski <majeski@google.com>
Cr-Commit-Position: refs/heads/master@{#49415}
parent b8b622c9
......@@ -137,7 +137,7 @@ class BenchmarksTestSuite(testsuite.TestSuite):
elif testcase.path.startswith("sunspider"):
files.append(os.path.join(self.testroot, "%s.js" % testcase.path))
return files, testcase.flags + context.mode_flags
return files, testcase.flags + context.mode_flags, {}
def GetSourceForTest(self, testcase):
filename = os.path.join(self.testroot, testcase.path + ".js")
......
......@@ -62,7 +62,7 @@ class CcTestSuite(testsuite.TestSuite):
return tests
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"
......
......@@ -63,13 +63,11 @@ class DebuggerTestSuite(testsuite.TestSuite):
files.append("--module")
files.append(os.path.join(self.root, testcase.path + self.suffix()))
all_files = []
all_files += files
all_files = list(files)
if context.isolates:
all_files.append("--isolate")
all_files += files
all_files += ["--isolate"] + files
return all_files, flags
return all_files, flags, {}
def GetSourceForTest(self, testcase):
filename = os.path.join(self.root, testcase.path + self.suffix())
......
......@@ -42,7 +42,7 @@ class FuzzerTestSuite(testsuite.TestSuite):
def GetParametersForTestCase(self, testcase, context):
suite, name = testcase.path.split('/')
return [os.path.join(self.root, suite, name)], []
return [os.path.join(self.root, suite, name)], [], {}
def _VariantGeneratorFactory(self):
return FuzzerVariantGenerator
......
......@@ -49,7 +49,7 @@ class InspectorProtocolTestSuite(testsuite.TestSuite):
os.path.join(self.root, PROTOCOL_TEST_JS),
os.path.join(self.root, testcase.path + self.suffix()),
]
return files, flags
return files, flags, {}
def GetSourceForTest(self, testcase):
filename = os.path.join(self.root, testcase.path + self.suffix())
......
......@@ -70,13 +70,11 @@ class IntlTestSuite(testsuite.TestSuite):
files.append(os.path.join(self.root, testcase.path + self.suffix()))
files.append(os.path.join(self.root, "regexp-assert.js"))
all_files = []
all_files += files
all_files = list(files)
if context.isolates:
all_files.append("--isolate")
all_files += files
all_files += ["--isolate"] + files
return all_files, flags
return all_files, flags, {}
def GetSourceForTest(self, testcase):
filename = os.path.join(self.root, testcase.path + self.suffix())
......
......@@ -74,7 +74,7 @@ class MessageTestSuite(testsuite.TestSuite):
for match in flags_match:
flags += match.strip().split()
flags = [x for x in flags if x not in INVALID_FLAGS]
return files, flags
return files, flags, {}
def GetSourceForTest(self, testcase):
filename = os.path.join(self.root, testcase.path + self.suffix())
......
......@@ -61,8 +61,11 @@ class MjsunitTestSuite(testsuite.TestSuite):
return tests
def GetParametersForTestCase(self, testcase, context):
flags = testcase.flags + context.mode_flags
source = self.GetSourceForTest(testcase)
flags = testcase.flags + context.mode_flags
env = self._get_env(source)
flags_match = re.findall(FLAGS_PATTERN, source)
for match in flags_match:
flags += match.strip().split()
......@@ -80,8 +83,9 @@ class MjsunitTestSuite(testsuite.TestSuite):
for f in files_list ]
testfilename = os.path.join(self.root, testcase.path + self.suffix())
if SELF_SCRIPT_PATTERN.search(source):
env = ["-e", "TEST_FILE_NAME=\"%s\"" % testfilename.replace("\\", "\\\\")]
files = env + files
files = (
["-e", "TEST_FILE_NAME=\"%s\"" % testfilename.replace("\\", "\\\\")] +
files)
if not context.no_harness and not NO_HARNESS_PATTERN.search(source):
files.append(os.path.join(self.root, "mjsunit.js"))
......@@ -90,19 +94,20 @@ class MjsunitTestSuite(testsuite.TestSuite):
files.append("--module")
files.append(testfilename)
all_files = []
all_files += files
all_files = list(files)
if context.isolates:
all_files.append("--isolate")
all_files += files
all_files += ["--isolate"] + files
return all_files, flags, env
def _get_env(self, source):
env_match = ENV_PATTERN.search(source)
env = {}
if env_match:
for env_pair in env_match.group(1).strip().split():
var, value = env_pair.split('=')
testcase.env[var] = value
return all_files, flags
env[var] = value
return env
def GetSourceForTest(self, testcase):
filename = os.path.join(self.root, testcase.path + self.suffix())
......
......@@ -19,7 +19,7 @@ class MkGrokdump(testsuite.TestSuite):
return [test]
def GetParametersForTestCase(self, testcase, context):
return [], []
return [], [], {}
def IsFailureOutput(self, testcase):
output = testcase.output
......
......@@ -93,7 +93,7 @@ class MozillaTestSuite(testsuite.TestSuite):
files.append(script)
files.append(os.path.join(self.testroot, testfilename))
flags = testcase.flags + context.mode_flags + ["--expose-gc"]
return files, flags
return files, flags, {}
def GetSourceForTest(self, testcase):
filename = os.path.join(self.testroot, testcase.path + ".js")
......
......@@ -72,7 +72,7 @@ class PreparserTestSuite(testsuite.TestSuite):
return result
def GetParametersForTestCase(self, testcase, context):
return [], testcase.flags
return [], testcase.flags, {}
def GetSourceForTest(self, testcase):
assert testcase.flags[0] == "-e"
......
......@@ -78,7 +78,7 @@ class PromiseAplusTestSuite(testsuite.TestSuite):
self.helper_files_post
)
flags = testcase.flags + context.mode_flags + ['--allow-natives-syntax']
return files, flags
return files, flags, {}
def GetSourceForTest(self, testcase):
filename = os.path.join(self.root, TEST_NAME,
......
......@@ -174,7 +174,7 @@ class Test262TestSuite(testsuite.TestSuite):
([flag for (feature, flag) in FEATURE_FLAGS.items()
if feature in self.GetTestRecord(testcase).get("features", [])])
)
return files, flags
return files, flags, {}
def _VariantGeneratorFactory(self):
return Test262VariantGenerator
......
......@@ -28,7 +28,7 @@ class WasmSpecTestsTestSuite(testsuite.TestSuite):
def GetParametersForTestCase(self, testcase, context):
flags = testcase.flags + context.mode_flags
files = [os.path.join(self.root, testcase.path + self.suffix())]
return files, flags
return files, flags, {}
def GetSuite(name, root):
......
......@@ -88,13 +88,11 @@ class WebkitTestSuite(testsuite.TestSuite):
files.append(testfilename)
files.append(os.path.join(self.root, "resources/standalone-post.js"))
all_files = []
all_files += files
all_files = list(files)
if context.isolates:
all_files.append("--isolate")
all_files += files
all_files += ["--isolate"] + files
return all_files, flags
return all_files, flags, {}
def GetSourceForTest(self, testcase):
filename = os.path.join(self.root, testcase.path + self.suffix())
......
......@@ -92,7 +92,7 @@ def GetCommand(test, context):
shell += ".exe"
if context.random_seed:
d8testflag += ["--random-seed=%s" % context.random_seed]
files, flags = test.suite.GetParametersForTestCase(test, context)
files, flags, env = test.suite.GetParametersForTestCase(test, context)
cmd = (
context.command_prefix +
[os.path.abspath(os.path.join(context.shell_dir, shell))] +
......@@ -102,11 +102,11 @@ def GetCommand(test, context):
# Flags from test cases can overwrite extra cmd-line flags.
flags
)
return cmd
return cmd, env
def _GetInstructions(test, context):
command = GetCommand(test, context)
command, env = GetCommand(test, context)
timeout = context.timeout
if ("--stress-opt" in test.flags or
"--stress-opt" in context.mode_flags or
......@@ -116,9 +116,10 @@ def _GetInstructions(test, context):
timeout *= 2
# FIXME(machenbach): Make this more OO. Don't expose default outcomes or
# the like.
if statusfile.IsSlow(test.outcomes or [statusfile.PASS]):
timeout *= 2
return Instructions(command, test.id, timeout, context.verbose, test.env)
return Instructions(command, test.id, timeout, context.verbose, env)
class Job(object):
......
......@@ -71,7 +71,7 @@ class ProgressIndicator(object):
}
def _EscapeCommand(self, test):
command = execution.GetCommand(test, self.runner.context)
command, _ = execution.GetCommand(test, self.runner.context)
parts = []
for part in command:
if ' ' in part:
......
......@@ -258,7 +258,7 @@ class TestSuite(object):
self.tests = filtered
def GetParametersForTestCase(self, testcase, context):
"""Returns a tuple of (files, flags) for this test case."""
"""Returns a tuple of (files, flags, env) for this test case."""
raise NotImplementedError
def GetSourceForTest(self, testcase):
......@@ -350,10 +350,13 @@ class GoogleTestSuite(TestSuite):
return tests
def GetParametersForTestCase(self, testcase, context):
return [], (testcase.flags + ["--gtest_filter=" + testcase.path] +
["--gtest_random_seed=%s" % context.random_seed] +
["--gtest_print_time=0"] +
context.mode_flags)
flags = (
testcase.flags +
["--gtest_filter=" + testcase.path] +
["--gtest_random_seed=%s" % context.random_seed] +
["--gtest_print_time=0"] +
context.mode_flags)
return [], flags, {}
def _VariantGeneratorFactory(self):
return StandardVariantGenerator
......
......@@ -39,13 +39,11 @@ class TestCase(object):
self.id = None # int, used to map result back to TestCase instance
self.duration = None # assigned during execution
self.run = 1 # The nth time this test is executed.
self.env = {}
def CopyAddingFlags(self, variant, flags):
copy = TestCase(self.suite, self.path, variant, self.flags + flags,
self.override_shell)
copy.outcomes = self.outcomes
copy.env = self.env
return copy
def SetSuiteObject(self, suites):
......
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