Commit 385611cb authored by Michal Majewski's avatar Michal Majewski Committed by Commit Bot

Reland "[test] Keep the order of variants"

This is a reland of 8f4407fb.

Original change's description:
> [test] Keep the order of variants
> 
> Bug: v8:6917
> Change-Id: I7e04255649f62a28f0ed07ccb4fbaf4825498bf6
> Reviewed-on: https://chromium-review.googlesource.com/886841
> Commit-Queue: Michał Majewski <majeski@google.com>
> Reviewed-by: Michael Achenbach <machenbach@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#50874}

Bug: v8:6917
Change-Id: I9d4c617ccec6db8929af3095f2f27d8964c5d6b8
Reviewed-on: https://chromium-review.googlesource.com/888582Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Michał Majewski <majeski@google.com>
Cr-Commit-Position: refs/heads/master@{#50901}
parent 4dcf68e9
...@@ -58,13 +58,6 @@ class TestSuite(testsuite.TestSuite): ...@@ -58,13 +58,6 @@ class TestSuite(testsuite.TestSuite):
def _test_class(self): def _test_class(self):
return TestCase return TestCase
def CreateLegacyVariantsGenerator(self, variants):
return super(TestSuite, self).CreateLegacyVariantsGenerator(
variants + ["preparser"])
def create_variant_proc(self, variants):
return super(TestSuite, self).create_variant_proc(variants + ['preparser'])
class TestCase(testcase.TestCase): class TestCase(testcase.TestCase):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
......
...@@ -43,7 +43,7 @@ STANDARD_VARIANT = set(["default"]) ...@@ -43,7 +43,7 @@ STANDARD_VARIANT = set(["default"])
class LegacyVariantsGenerator(object): class LegacyVariantsGenerator(object):
def __init__(self, suite, variants): def __init__(self, suite, variants):
self.suite = suite self.suite = suite
self.all_variants = ALL_VARIANTS & variants self.all_variants = variants
self.standard_variant = STANDARD_VARIANT & variants self.standard_variant = STANDARD_VARIANT & variants
def FilterVariantsByTest(self, test): def FilterVariantsByTest(self, test):
......
...@@ -25,4 +25,27 @@ ALL_VARIANT_FLAGS = { ...@@ -25,4 +25,27 @@ ALL_VARIANT_FLAGS = {
"wasm_traps": [["--wasm_trap_handler", "--invoke-weak-callbacks", "--wasm-jit-to-native"]], "wasm_traps": [["--wasm_trap_handler", "--invoke-weak-callbacks", "--wasm-jit-to-native"]],
} }
ALL_VARIANTS = set(ALL_VARIANT_FLAGS.keys()) SLOW_VARIANTS = set([
'stress',
'nooptimization',
])
FAST_VARIANTS = set([
'default'
])
def _variant_order_key(v):
if v in SLOW_VARIANTS:
return 0
if v in FAST_VARIANTS:
return 100
return 50
ALL_VARIANTS = sorted(ALL_VARIANT_FLAGS.keys(),
key=_variant_order_key)
# Check {SLOW,FAST}_VARIANTS entries
for variants in [SLOW_VARIANTS, FAST_VARIANTS]:
for v in variants:
assert v in ALL_VARIANT_FLAGS
...@@ -39,14 +39,13 @@ from testrunner.testproc.variant import VariantProc ...@@ -39,14 +39,13 @@ from testrunner.testproc.variant import VariantProc
TIMEOUT_DEFAULT = 60 TIMEOUT_DEFAULT = 60
# Variants ordered by expected runtime (slowest first).
VARIANTS = ["default"] VARIANTS = ["default"]
MORE_VARIANTS = [ MORE_VARIANTS = [
"stress",
"stress_incremental_marking",
"nooptimization", "nooptimization",
"stress",
"stress_background_compile", "stress_background_compile",
"stress_incremental_marking",
"wasm_traps", "wasm_traps",
] ]
...@@ -112,6 +111,7 @@ class StandardTestRunner(base_runner.BaseTestRunner): ...@@ -112,6 +111,7 @@ class StandardTestRunner(base_runner.BaseTestRunner):
super(StandardTestRunner, self).__init__(*args, **kwargs) super(StandardTestRunner, self).__init__(*args, **kwargs)
self.sancov_dir = None self.sancov_dir = None
self._variants = None
def _get_default_suite_names(self): def _get_default_suite_names(self):
return ['default'] return ['default']
...@@ -249,8 +249,6 @@ class StandardTestRunner(base_runner.BaseTestRunner): ...@@ -249,8 +249,6 @@ class StandardTestRunner(base_runner.BaseTestRunner):
return False return False
def _process_options(self, options): def _process_options(self, options):
global VARIANTS
if options.sancov_dir: if options.sancov_dir:
self.sancov_dir = options.sancov_dir self.sancov_dir = options.sancov_dir
if not os.path.exists(self.sancov_dir): if not os.path.exists(self.sancov_dir):
...@@ -315,9 +313,6 @@ class StandardTestRunner(base_runner.BaseTestRunner): ...@@ -315,9 +313,6 @@ class StandardTestRunner(base_runner.BaseTestRunner):
if options.random_seed_stress_count <= 1 and options.random_seed == 0: if options.random_seed_stress_count <= 1 and options.random_seed == 0:
options.random_seed = self._random_seed() options.random_seed = self._random_seed()
# Use developer defaults if no variant was specified.
options.variants = options.variants or "dev"
if options.variants == "infra_staging": if options.variants == "infra_staging":
options.variants = "exhaustive" options.variants = "exhaustive"
options.infra_staging = True options.infra_staging = True
...@@ -325,18 +320,7 @@ class StandardTestRunner(base_runner.BaseTestRunner): ...@@ -325,18 +320,7 @@ class StandardTestRunner(base_runner.BaseTestRunner):
# Use staging on whitelisted masters/builders. # Use staging on whitelisted masters/builders.
options.infra_staging = self._use_staging(options) options.infra_staging = self._use_staging(options)
# Resolve variant aliases and dedupe. self._variants = self._parse_variants(options.variants)
# TODO(machenbach): Don't mutate global variable. Rather pass mutated
# version as local variable.
VARIANTS = list(set(reduce(
list.__add__,
(VARIANT_ALIASES.get(v, [v]) for v in options.variants.split(",")),
[],
)))
if not set(VARIANTS).issubset(ALL_VARIANTS):
print "All variants must be in %s" % str(ALL_VARIANTS)
raise base_runner.TestRunnerError()
def CheckTestMode(name, option): # pragma: no cover def CheckTestMode(name, option): # pragma: no cover
if not option in ["run", "skip", "dontcare"]: if not option in ["run", "skip", "dontcare"]:
...@@ -350,6 +334,23 @@ class StandardTestRunner(base_runner.BaseTestRunner): ...@@ -350,6 +334,23 @@ class StandardTestRunner(base_runner.BaseTestRunner):
# TODO(machenbach): uncomment after infra side lands. # TODO(machenbach): uncomment after infra side lands.
# base_runner.TEST_MAP["d8_default"].remove("intl") # base_runner.TEST_MAP["d8_default"].remove("intl")
def _parse_variants(self, aliases_str):
# Use developer defaults if no variant was specified.
aliases_str = aliases_str or 'dev'
aliases = aliases_str.split(',')
user_variants = set(reduce(
list.__add__, [VARIANT_ALIASES.get(a, [a]) for a in aliases]))
result = [v for v in ALL_VARIANTS if v in user_variants]
if len(result) == len(user_variants):
return result
for v in user_variants:
if v not in ALL_VARIANTS:
print 'Unknown variant: %s' % v
raise base_runner.TestRunnerError()
assert False, 'Unreachable'
def _setup_env(self): def _setup_env(self):
super(StandardTestRunner, self)._setup_env() super(StandardTestRunner, self)._setup_env()
...@@ -481,7 +482,7 @@ class StandardTestRunner(base_runner.BaseTestRunner): ...@@ -481,7 +482,7 @@ class StandardTestRunner(base_runner.BaseTestRunner):
if options.cat: if options.cat:
verbose.PrintTestSource(s.tests) verbose.PrintTestSource(s.tests)
continue continue
variant_gen = s.CreateLegacyVariantsGenerator(VARIANTS) variant_gen = s.CreateLegacyVariantsGenerator(self._variants)
variant_tests = [ t.create_variant(v, flags) variant_tests = [ t.create_variant(v, flags)
for t in s.tests for t in s.tests
for v in variant_gen.FilterVariantsByTest(t) for v in variant_gen.FilterVariantsByTest(t)
...@@ -597,7 +598,7 @@ class StandardTestRunner(base_runner.BaseTestRunner): ...@@ -597,7 +598,7 @@ class StandardTestRunner(base_runner.BaseTestRunner):
StatusFileFilterProc(options.slow_tests, options.pass_fail_tests), StatusFileFilterProc(options.slow_tests, options.pass_fail_tests),
self._create_shard_proc(options), self._create_shard_proc(options),
tests_counter, tests_counter,
VariantProc(VARIANTS), VariantProc(self._variants),
StatusFileFilterProc(options.slow_tests, options.pass_fail_tests), StatusFileFilterProc(options.slow_tests, options.pass_fail_tests),
] + indicators + [ ] + indicators + [
results, results,
......
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