Chromium Code Reviews| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 if filename.endswith(".js") and not filename.endswith("_FIXTURE.js"): | 124 if filename.endswith(".js") and not filename.endswith("_FIXTURE.js"): |
| 125 fullpath = os.path.join(dirname, filename) | 125 fullpath = os.path.join(dirname, filename) |
| 126 relpath = fullpath[len(self.testroot) + 1 : -3] | 126 relpath = fullpath[len(self.testroot) + 1 : -3] |
| 127 testname = relpath.replace(os.path.sep, "/") | 127 testname = relpath.replace(os.path.sep, "/") |
| 128 case = testcase.TestCase(self, testname) | 128 case = testcase.TestCase(self, testname) |
| 129 tests.append(case) | 129 tests.append(case) |
| 130 return tests | 130 return tests |
| 131 | 131 |
| 132 def GetFlagsForTestCase(self, testcase, context): | 132 def GetFlagsForTestCase(self, testcase, context): |
| 133 return (testcase.flags + context.mode_flags + self.harness + | 133 return (testcase.flags + context.mode_flags + self.harness + |
| 134 self.GetIncludesForTest(testcase) + ["--harmony"] + | 134 self.GetIncludesForTest(testcase) + |
| 135 (["--module"] if "module" in self.GetTestRecord(testcase) else []) + | 135 (["--module"] if "module" in self.GetTestRecord(testcase) else []) + |
| 136 [os.path.join(self.testroot, testcase.path + ".js")] + | 136 [os.path.join(self.testroot, testcase.path + ".js")] + |
| 137 (["--throws"] if "negative" in self.GetTestRecord(testcase) | 137 (["--throws"] if "negative" in self.GetTestRecord(testcase) |
| 138 else []) + | 138 else []) + |
| 139 (["--allow-natives-syntax"] | 139 (["--allow-natives-syntax"] |
| 140 if "detachArrayBuffer.js" in | 140 if "detachArrayBuffer.js" in |
| 141 self.GetTestRecord(testcase).get("includes", []) | 141 self.GetTestRecord(testcase).get("includes", []) |
| 142 else [])) | 142 else []) + |
| 143 ([flag for flag in testcase.outcomes if flag.startswith("--")])) | |
|
Michael Achenbach
2017/01/05 13:34:42
Maybe add an access method for this in testcase. A
Dan Ehrenberg
2017/01/05 15:36:11
I'm a little reluctant to go and touch testcase, w
| |
| 143 | 144 |
| 144 def _VariantGeneratorFactory(self): | 145 def _VariantGeneratorFactory(self): |
| 145 return Test262VariantGenerator | 146 return Test262VariantGenerator |
| 146 | 147 |
| 147 def LoadParseTestRecord(self): | 148 def LoadParseTestRecord(self): |
| 148 if not self.ParseTestRecord: | 149 if not self.ParseTestRecord: |
| 149 root = os.path.join(self.root, *TEST_262_TOOLS_PATH) | 150 root = os.path.join(self.root, *TEST_262_TOOLS_PATH) |
| 150 f = None | 151 f = None |
| 151 try: | 152 try: |
| 152 (f, pathname, description) = imp.find_module("parseTestRecord", [root]) | 153 (f, pathname, description) = imp.find_module("parseTestRecord", [root]) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 "type" in test_record["negative"] and \ | 199 "type" in test_record["negative"] and \ |
| 199 self._ParseException(output.stdout) != test_record["negative"]["type"]: | 200 self._ParseException(output.stdout) != test_record["negative"]["type"]: |
| 200 return True | 201 return True |
| 201 return "FAILED!" in output.stdout | 202 return "FAILED!" in output.stdout |
| 202 | 203 |
| 203 def HasUnexpectedOutput(self, testcase): | 204 def HasUnexpectedOutput(self, testcase): |
| 204 outcome = self.GetOutcome(testcase) | 205 outcome = self.GetOutcome(testcase) |
| 205 if (statusfile.FAIL_SLOPPY in testcase.outcomes and | 206 if (statusfile.FAIL_SLOPPY in testcase.outcomes and |
| 206 "--use-strict" not in testcase.flags): | 207 "--use-strict" not in testcase.flags): |
| 207 return outcome != statusfile.FAIL | 208 return outcome != statusfile.FAIL |
| 208 return not outcome in (testcase.outcomes or [statusfile.PASS]) | 209 return not outcome in ([outcome for outcome in testcase.outcomes |
| 210 if not outcome.startswith('--')] | |
| 211 or [statusfile.PASS]) | |
| 209 | 212 |
| 210 def PrepareSources(self): | 213 def PrepareSources(self): |
| 211 # The archive is created only on swarming. Local checkouts have the | 214 # The archive is created only on swarming. Local checkouts have the |
| 212 # data folder. | 215 # data folder. |
| 213 if os.path.exists(ARCHIVE) and not os.path.exists(DATA): | 216 if os.path.exists(ARCHIVE) and not os.path.exists(DATA): |
| 214 print "Extracting archive..." | 217 print "Extracting archive..." |
| 215 tar = tarfile.open(ARCHIVE) | 218 tar = tarfile.open(ARCHIVE) |
| 216 tar.extractall(path=os.path.dirname(ARCHIVE)) | 219 tar.extractall(path=os.path.dirname(ARCHIVE)) |
| 217 tar.close() | 220 tar.close() |
| 218 | 221 |
| 219 | 222 |
| 220 def GetSuite(name, root): | 223 def GetSuite(name, root): |
| 221 return Test262TestSuite(name, root) | 224 return Test262TestSuite(name, root) |
| OLD | NEW |