Chromium Code Reviews| Index: test/test262-es6/testcfg.py |
| diff --git a/test/test262-es6/testcfg.py b/test/test262-es6/testcfg.py |
| index 91491b3907f1c04c5e9d68ff388c8f2fae1f1362..aef32550f3624dc0fa06d6a041f004a03bccb8a4 100644 |
| --- a/test/test262-es6/testcfg.py |
| +++ b/test/test262-es6/testcfg.py |
| @@ -26,6 +26,7 @@ |
| # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| +import collections |
| import hashlib |
| import os |
| import shutil |
| @@ -35,6 +36,7 @@ import imp |
| from testrunner.local import statusfile |
| from testrunner.local import testsuite |
| +from testrunner.local.testsuite import FilterVariants |
| from testrunner.local import utils |
| from testrunner.objects import testcase |
| @@ -48,6 +50,64 @@ TEST_262_SUITE_PATH = ["data", "test"] |
| TEST_262_HARNESS_PATH = ["data", "harness"] |
| TEST_262_TOOLS_PATH = ["data", "tools", "packaging"] |
| +STRICT_VARIANTS = [ |
| + (v, flags + ["--use-strict"]) |
| + for (v, flags) in testsuite.ALL_VARIANTS |
| +] |
| + |
| +STRICT_FAST_VARIANTS = [ |
| + (v, flags + ["--use-strict"]) |
| + for (v, flags) in testsuite.FAST_VARIANTS |
| +] |
| + |
| +STRICT_DEFAULT_VARIANT = [ |
| + (v, flags + ["--use-strict"]) |
| + for (v, flags) in testsuite.DEFAULT_VARIANT |
| +] |
| + |
| +class Test262VariantFlagsBuilder(testsuite.VariantFlagsBuilder): |
| + def __init__(self, suite, variant_filter): |
| + super(Test262VariantFlagsBuilder, self).__init__(suite, variant_filter) |
| + all_strict = FilterVariants(STRICT_VARIANTS, variant_filter) |
| + fast_strict = FilterVariants(STRICT_FAST_VARIANTS, variant_filter) |
| + default_strict = FilterVariants(STRICT_DEFAULT_VARIANT, variant_filter) |
| + |
|
Michael Achenbach
2015/07/27 12:37:46
This precomputes the variants, so that on iteratio
|
| + Variants = collections.namedtuple( |
| + 'Variants', ['nostrict', 'strict', 'both']) |
| + self.default = Variants( |
| + self.default_variant, |
| + default_strict, |
| + self.default_variant + default_strict, |
| + ) |
| + self.fast = Variants( |
| + self.fast_variants, |
| + fast_strict, |
| + self.fast_variants + fast_strict, |
| + ) |
| + self.all = Variants( |
| + self.all_variants, |
| + all_strict, |
| + self.all_variants + all_strict, |
| + ) |
| + |
| + def _Variant(self, testcase, variants): |
| + test_record = self.suite.GetTestRecord(testcase) |
| + if "noStrict" in test_record: |
| + return variants.nostrict |
| + if "onlyStrict" in test_record: |
| + return variants.strict |
| + return variants.both |
|
Michael Achenbach
2015/07/27 12:37:45
Minor drawback: In the both-case, also after this
|
| + |
| + def DefaultVariant(self, testcase): |
| + return self._Variant(testcase, self.default) |
| + |
| + def FastVariants(self, testcase): |
| + return self._Variant(testcase, self.fast) |
| + |
| + def AllVariants(self, testcase): |
| + return self._Variant(testcase, self.all) |
| + |
| + |
| class Test262TestSuite(testsuite.TestSuite): |
| def __init__(self, name, root): |
| @@ -81,15 +141,8 @@ class Test262TestSuite(testsuite.TestSuite): |
| self.GetIncludesForTest(testcase) + ["--harmony"] + |
| [os.path.join(self.testroot, testcase.path + ".js")]) |
| - def VariantFlags(self, testcase, default_flags): |
| - flags = super(Test262TestSuite, self).VariantFlags(testcase, default_flags) |
| - test_record = self.GetTestRecord(testcase) |
| - if "noStrict" in test_record: |
| - return flags |
| - strict_flags = [f + ["--use-strict"] for f in flags] |
| - if "onlyStrict" in test_record: |
| - return strict_flags |
| - return flags + strict_flags |
| + def VariantFlagsBuilder(self): |
| + return Test262VariantFlagsBuilder |
| def LoadParseTestRecord(self): |
| if not self.ParseTestRecord: |