| OLD | NEW |
| 1 # Copyright 2012 the V8 project authors. All rights reserved. | 1 # Copyright 2012 the V8 project authors. All rights reserved. |
| 2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
| 3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
| 4 # met: | 4 # met: |
| 5 # | 5 # |
| 6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
| 9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
| 10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 # The revision hash needs to be 7 characters? | 41 # The revision hash needs to be 7 characters? |
| 42 TEST_262_ARCHIVE_REVISION = "c6ac390" # This is the 2015-07-06 revision. | 42 TEST_262_ARCHIVE_REVISION = "c6ac390" # This is the 2015-07-06 revision. |
| 43 TEST_262_ARCHIVE_MD5 = "e1393ef330f38e9cb1bfa4e3eada5ba8" | 43 TEST_262_ARCHIVE_MD5 = "e1393ef330f38e9cb1bfa4e3eada5ba8" |
| 44 TEST_262_URL = "https://github.com/tc39/test262/tarball/%s" | 44 TEST_262_URL = "https://github.com/tc39/test262/tarball/%s" |
| 45 TEST_262_HARNESS_FILES = ["sta.js", "assert.js"] | 45 TEST_262_HARNESS_FILES = ["sta.js", "assert.js"] |
| 46 | 46 |
| 47 TEST_262_SUITE_PATH = ["data", "test"] | 47 TEST_262_SUITE_PATH = ["data", "test"] |
| 48 TEST_262_HARNESS_PATH = ["data", "harness"] | 48 TEST_262_HARNESS_PATH = ["data", "harness"] |
| 49 TEST_262_TOOLS_PATH = ["data", "tools", "packaging"] | 49 TEST_262_TOOLS_PATH = ["data", "tools", "packaging"] |
| 50 | 50 |
| 51 ALL_VARIANT_FLAGS_STRICT = dict( |
| 52 (v, [flags + ["--use-strict"] for flags in flag_sets]) |
| 53 for v, flag_sets in testsuite.ALL_VARIANT_FLAGS.iteritems() |
| 54 ) |
| 55 |
| 56 FAST_VARIANT_FLAGS_STRICT = dict( |
| 57 (v, [flags + ["--use-strict"] for flags in flag_sets]) |
| 58 for v, flag_sets in testsuite.FAST_VARIANT_FLAGS.iteritems() |
| 59 ) |
| 60 |
| 61 ALL_VARIANT_FLAGS_BOTH = dict( |
| 62 (v, [flags for flags in testsuite.ALL_VARIANT_FLAGS[v] + |
| 63 ALL_VARIANT_FLAGS_STRICT[v]]) |
| 64 for v in testsuite.ALL_VARIANT_FLAGS |
| 65 ) |
| 66 |
| 67 FAST_VARIANT_FLAGS_BOTH = dict( |
| 68 (v, [flags for flags in testsuite.FAST_VARIANT_FLAGS[v] + |
| 69 FAST_VARIANT_FLAGS_STRICT[v]]) |
| 70 for v in testsuite.FAST_VARIANT_FLAGS |
| 71 ) |
| 72 |
| 73 ALL_VARIANTS = { |
| 74 'nostrict': testsuite.ALL_VARIANT_FLAGS, |
| 75 'strict': ALL_VARIANT_FLAGS_STRICT, |
| 76 'both': ALL_VARIANT_FLAGS_BOTH, |
| 77 } |
| 78 |
| 79 FAST_VARIANTS = { |
| 80 'nostrict': testsuite.FAST_VARIANT_FLAGS, |
| 81 'strict': FAST_VARIANT_FLAGS_STRICT, |
| 82 'both': FAST_VARIANT_FLAGS_BOTH, |
| 83 } |
| 84 |
| 85 class Test262VariantGenerator(testsuite.VariantGenerator): |
| 86 def GetFlagSets(self, testcase, variant): |
| 87 if testcase.outcomes and statusfile.OnlyFastVariants(testcase.outcomes): |
| 88 variant_flags = FAST_VARIANTS |
| 89 else: |
| 90 variant_flags = ALL_VARIANTS |
| 91 |
| 92 test_record = self.suite.GetTestRecord(testcase) |
| 93 if "noStrict" in test_record: |
| 94 return variant_flags["nostrict"][variant] |
| 95 if "onlyStrict" in test_record: |
| 96 return variant_flags["strict"][variant] |
| 97 return variant_flags["both"][variant] |
| 98 |
| 99 |
| 51 class Test262TestSuite(testsuite.TestSuite): | 100 class Test262TestSuite(testsuite.TestSuite): |
| 52 | 101 |
| 53 def __init__(self, name, root): | 102 def __init__(self, name, root): |
| 54 super(Test262TestSuite, self).__init__(name, root) | 103 super(Test262TestSuite, self).__init__(name, root) |
| 55 self.testroot = os.path.join(self.root, *TEST_262_SUITE_PATH) | 104 self.testroot = os.path.join(self.root, *TEST_262_SUITE_PATH) |
| 56 self.harnesspath = os.path.join(self.root, *TEST_262_HARNESS_PATH) | 105 self.harnesspath = os.path.join(self.root, *TEST_262_HARNESS_PATH) |
| 57 self.harness = [os.path.join(self.harnesspath, f) | 106 self.harness = [os.path.join(self.harnesspath, f) |
| 58 for f in TEST_262_HARNESS_FILES] | 107 for f in TEST_262_HARNESS_FILES] |
| 59 self.harness += [os.path.join(self.root, "harness-adapt.js")] | 108 self.harness += [os.path.join(self.root, "harness-adapt.js")] |
| 60 self.ParseTestRecord = None | 109 self.ParseTestRecord = None |
| (...skipping 13 matching lines...) Expand all Loading... |
| 74 filename[:-3]) | 123 filename[:-3]) |
| 75 case = testcase.TestCase(self, testname) | 124 case = testcase.TestCase(self, testname) |
| 76 tests.append(case) | 125 tests.append(case) |
| 77 return tests | 126 return tests |
| 78 | 127 |
| 79 def GetFlagsForTestCase(self, testcase, context): | 128 def GetFlagsForTestCase(self, testcase, context): |
| 80 return (testcase.flags + context.mode_flags + self.harness + | 129 return (testcase.flags + context.mode_flags + self.harness + |
| 81 self.GetIncludesForTest(testcase) + ["--harmony"] + | 130 self.GetIncludesForTest(testcase) + ["--harmony"] + |
| 82 [os.path.join(self.testroot, testcase.path + ".js")]) | 131 [os.path.join(self.testroot, testcase.path + ".js")]) |
| 83 | 132 |
| 84 def VariantFlags(self, testcase, default_flags): | 133 def _VariantGeneratorFactory(self): |
| 85 flags = super(Test262TestSuite, self).VariantFlags(testcase, default_flags) | 134 return Test262VariantGenerator |
| 86 test_record = self.GetTestRecord(testcase) | |
| 87 if "noStrict" in test_record: | |
| 88 return flags | |
| 89 strict_flags = [f + ["--use-strict"] for f in flags] | |
| 90 if "onlyStrict" in test_record: | |
| 91 return strict_flags | |
| 92 return flags + strict_flags | |
| 93 | 135 |
| 94 def LoadParseTestRecord(self): | 136 def LoadParseTestRecord(self): |
| 95 if not self.ParseTestRecord: | 137 if not self.ParseTestRecord: |
| 96 root = os.path.join(self.root, *TEST_262_TOOLS_PATH) | 138 root = os.path.join(self.root, *TEST_262_TOOLS_PATH) |
| 97 f = None | 139 f = None |
| 98 try: | 140 try: |
| 99 (f, pathname, description) = imp.find_module("parseTestRecord", [root]) | 141 (f, pathname, description) = imp.find_module("parseTestRecord", [root]) |
| 100 module = imp.load_module("parseTestRecord", f, pathname, description) | 142 module = imp.load_module("parseTestRecord", f, pathname, description) |
| 101 self.ParseTestRecord = module.parseTestRecord | 143 self.ParseTestRecord = module.parseTestRecord |
| 102 except: | 144 except: |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 # Magic incantation to allow longer path names on Windows. | 226 # Magic incantation to allow longer path names on Windows. |
| 185 archive.extractall(u"\\\\?\\%s" % self.root) | 227 archive.extractall(u"\\\\?\\%s" % self.root) |
| 186 else: | 228 else: |
| 187 archive.extractall(self.root) | 229 archive.extractall(self.root) |
| 188 os.rename(os.path.join(self.root, "tc39-test262-%s" % revision), | 230 os.rename(os.path.join(self.root, "tc39-test262-%s" % revision), |
| 189 directory_name) | 231 directory_name) |
| 190 | 232 |
| 191 | 233 |
| 192 def GetSuite(name, root): | 234 def GetSuite(name, root): |
| 193 return Test262TestSuite(name, root) | 235 return Test262TestSuite(name, root) |
| OLD | NEW |