Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1428)

Unified Diff: tools/testrunner/local/testsuite.py

Issue 1245623005: [test] Key variant flags by variant name everywhere. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix test262-es6 Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/run-tests.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testrunner/local/testsuite.py
diff --git a/tools/testrunner/local/testsuite.py b/tools/testrunner/local/testsuite.py
index 133c74eefba74c13c95b4043c5f05cd4022d1522..b7d20d108554d98af86b7e01d93d4ffb37b92012 100644
--- a/tools/testrunner/local/testsuite.py
+++ b/tools/testrunner/local/testsuite.py
@@ -35,15 +35,47 @@ from . import utils
from ..objects import testcase
# Use this to run several variants of the tests.
-VARIANT_FLAGS = {
- "default": [],
- "stress": ["--stress-opt", "--always-opt"],
- "turbofan": ["--turbo", "--always-opt"],
- "nocrankshaft": ["--nocrankshaft"]}
+ALL_VARIANT_FLAGS = {
+ "default": [[]],
+ "stress": [["--stress-opt", "--always-opt"]],
+ "turbofan": [["--turbo", "--always-opt"]],
+ "nocrankshaft": [["--nocrankshaft"]],
+}
+
+# FAST_VARIANTS implies no --always-opt.
+FAST_VARIANT_FLAGS = {
+ "default": [[]],
+ "stress": [["--stress-opt"]],
+ "turbofan": [["--turbo"]],
+ "nocrankshaft": [["--nocrankshaft"]],
+}
+
+ALL_VARIANTS = set(["default", "stress", "turbofan", "nocrankshaft"])
+FAST_VARIANTS = set(["default", "turbofan"])
+STANDARD_VARIANT = set(["default"])
+
+
+class VariantGenerator(object):
+ def __init__(self, suite, variants):
+ self.suite = suite
+ self.all_variants = ALL_VARIANTS & variants
+ self.fast_variants = FAST_VARIANTS & variants
+ self.standard_variant = STANDARD_VARIANT & variants
+
+ def FilterVariantsByTest(self, testcase):
+ if testcase.outcomes and statusfile.OnlyStandardVariant(
+ testcase.outcomes):
+ return self.standard_variant
+ if testcase.outcomes and statusfile.OnlyFastVariants(testcase.outcomes):
+ return self.fast_variants
+ return self.all_variants
+
+ def GetFlagSets(self, testcase, variant):
+ if testcase.outcomes and statusfile.OnlyFastVariants(testcase.outcomes):
+ return FAST_VARIANT_FLAGS[variant]
+ else:
+ return ALL_VARIANT_FLAGS[variant]
-FAST_VARIANT_FLAGS = [
- f for v, f in VARIANT_FLAGS.iteritems() if v in ["default", "turbofan"]
-]
class TestSuite(object):
@@ -89,15 +121,19 @@ class TestSuite(object):
def ListTests(self, context):
raise NotImplementedError
- def VariantFlags(self, testcase, default_flags):
- if testcase.outcomes and statusfile.OnlyStandardVariant(testcase.outcomes):
- return [[]]
- if testcase.outcomes and statusfile.OnlyFastVariants(testcase.outcomes):
- # FAST_VARIANTS implies no --always-opt.
- return [ filter(lambda flag: flag != "--always-opt", f)
- for f in filter(lambda flags: flags in FAST_VARIANT_FLAGS,
- default_flags) ]
- return default_flags
+ def _VariantGeneratorFactory(self):
+ """The variant generator class to be used."""
+ return VariantGenerator
+
+ def CreateVariantGenerator(self, variants):
+ """Return a generator for the testing variants of this suite.
+
+ Args:
+ variants: List of variant names to be run as specified by the test
+ runner.
+ Returns: An object of type VariantGenerator.
+ """
+ return self._VariantGeneratorFactory()(self, set(variants))
def DownloadData(self):
pass
@@ -252,6 +288,11 @@ class TestSuite(object):
return self.total_duration
+class StandardVariantGenerator(VariantGenerator):
+ def FilterVariantsByTest(self, testcase):
+ return self.standard_variant
+
+
class GoogleTestSuite(TestSuite):
def __init__(self, name, root):
super(GoogleTestSuite, self).__init__(name, root)
@@ -285,8 +326,8 @@ class GoogleTestSuite(TestSuite):
["--gtest_print_time=0"] +
context.mode_flags)
- def VariantFlags(self, testcase, default_flags):
- return [[]]
+ def _VariantGeneratorFactory(self):
+ return StandardVariantGenerator
def shell(self):
return self.name
« no previous file with comments | « tools/run-tests.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698