| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 continue | 135 continue |
| 136 if filename.endswith("_FIXTURE.js"): | 136 if filename.endswith("_FIXTURE.js"): |
| 137 continue | 137 continue |
| 138 fullpath = os.path.join(dirname, filename) | 138 fullpath = os.path.join(dirname, filename) |
| 139 relpath = re.match(TEST_262_RELPATH_REGEXP, fullpath).group(1) | 139 relpath = re.match(TEST_262_RELPATH_REGEXP, fullpath).group(1) |
| 140 testnames.add(relpath.replace(os.path.sep, "/")) | 140 testnames.add(relpath.replace(os.path.sep, "/")) |
| 141 return [testcase.TestCase(self, testname) for testname in testnames] | 141 return [testcase.TestCase(self, testname) for testname in testnames] |
| 142 | 142 |
| 143 def GetFlagsForTestCase(self, testcase, context): | 143 def GetFlagsForTestCase(self, testcase, context): |
| 144 return (testcase.flags + context.mode_flags + self.harness + | 144 return (testcase.flags + context.mode_flags + self.harness + |
| 145 self.GetIncludesForTest(testcase) + ["--harmony"] + | 145 self.GetIncludesForTest(testcase) + |
| 146 (["--module"] if "module" in self.GetTestRecord(testcase) else []) + | 146 (["--module"] if "module" in self.GetTestRecord(testcase) else []) + |
| 147 [self.GetPathForTest(testcase)] + | 147 [self.GetPathForTest(testcase)] + |
| 148 (["--throws"] if "negative" in self.GetTestRecord(testcase) | 148 (["--throws"] if "negative" in self.GetTestRecord(testcase) |
| 149 else []) + | 149 else []) + |
| 150 (["--allow-natives-syntax"] | 150 (["--allow-natives-syntax"] |
| 151 if "detachArrayBuffer.js" in | 151 if "detachArrayBuffer.js" in |
| 152 self.GetTestRecord(testcase).get("includes", []) | 152 self.GetTestRecord(testcase).get("includes", []) |
| 153 else [])) | 153 else []) + |
| 154 ([flag for flag in testcase.outcomes if flag.startswith("--")])) |
| 154 | 155 |
| 155 def _VariantGeneratorFactory(self): | 156 def _VariantGeneratorFactory(self): |
| 156 return Test262VariantGenerator | 157 return Test262VariantGenerator |
| 157 | 158 |
| 158 def LoadParseTestRecord(self): | 159 def LoadParseTestRecord(self): |
| 159 if not self.ParseTestRecord: | 160 if not self.ParseTestRecord: |
| 160 root = os.path.join(self.root, *TEST_262_TOOLS_PATH) | 161 root = os.path.join(self.root, *TEST_262_TOOLS_PATH) |
| 161 f = None | 162 f = None |
| 162 try: | 163 try: |
| 163 (f, pathname, description) = imp.find_module("parseTestRecord", [root]) | 164 (f, pathname, description) = imp.find_module("parseTestRecord", [root]) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 "type" in test_record["negative"] and \ | 215 "type" in test_record["negative"] and \ |
| 215 self._ParseException(output.stdout) != test_record["negative"]["type"]: | 216 self._ParseException(output.stdout) != test_record["negative"]["type"]: |
| 216 return True | 217 return True |
| 217 return "FAILED!" in output.stdout | 218 return "FAILED!" in output.stdout |
| 218 | 219 |
| 219 def HasUnexpectedOutput(self, testcase): | 220 def HasUnexpectedOutput(self, testcase): |
| 220 outcome = self.GetOutcome(testcase) | 221 outcome = self.GetOutcome(testcase) |
| 221 if (statusfile.FAIL_SLOPPY in testcase.outcomes and | 222 if (statusfile.FAIL_SLOPPY in testcase.outcomes and |
| 222 "--use-strict" not in testcase.flags): | 223 "--use-strict" not in testcase.flags): |
| 223 return outcome != statusfile.FAIL | 224 return outcome != statusfile.FAIL |
| 224 return not outcome in (testcase.outcomes or [statusfile.PASS]) | 225 return not outcome in ([outcome for outcome in testcase.outcomes |
| 226 if not outcome.startswith('--')] |
| 227 or [statusfile.PASS]) |
| 225 | 228 |
| 226 def PrepareSources(self): | 229 def PrepareSources(self): |
| 227 # The archive is created only on swarming. Local checkouts have the | 230 # The archive is created only on swarming. Local checkouts have the |
| 228 # data folder. | 231 # data folder. |
| 229 if os.path.exists(ARCHIVE) and not os.path.exists(DATA): | 232 if os.path.exists(ARCHIVE) and not os.path.exists(DATA): |
| 230 print "Extracting archive..." | 233 print "Extracting archive..." |
| 231 tar = tarfile.open(ARCHIVE) | 234 tar = tarfile.open(ARCHIVE) |
| 232 tar.extractall(path=os.path.dirname(ARCHIVE)) | 235 tar.extractall(path=os.path.dirname(ARCHIVE)) |
| 233 tar.close() | 236 tar.close() |
| 234 | 237 |
| 235 | 238 |
| 236 def GetSuite(name, root): | 239 def GetSuite(name, root): |
| 237 return Test262TestSuite(name, root) | 240 return Test262TestSuite(name, root) |
| OLD | NEW |