| 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
|
|
|