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 |
11 # with the distribution. | 11 # with the distribution. |
12 # * Neither the name of Google Inc. nor the names of its | 12 # * Neither the name of Google Inc. nor the names of its |
13 # contributors may be used to endorse or promote products derived | 13 # contributors may be used to endorse or promote products derived |
14 # from this software without specific prior written permission. | 14 # from this software without specific prior written permission. |
15 # | 15 # |
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 | 28 |
29 import hashlib | 29 import hashlib |
Jakob Kummerow
2015/10/08 14:00:05
don't need this any more
Michael Achenbach
2015/10/08 14:04:32
Done.
| |
30 import imp | 30 import imp |
31 import os | 31 import os |
32 import shutil | 32 import shutil |
33 import sys | 33 import sys |
34 import tarfile | 34 import tarfile |
Jakob Kummerow
2015/10/08 14:00:05
don't need this any more
Michael Achenbach
2015/10/08 14:04:32
Done.
| |
35 | 35 |
36 | 36 |
37 from testrunner.local import statusfile | 37 from testrunner.local import statusfile |
38 from testrunner.local import testsuite | 38 from testrunner.local import testsuite |
39 from testrunner.local import utils | 39 from testrunner.local import utils |
40 from testrunner.objects import testcase | 40 from testrunner.objects import testcase |
41 | 41 |
42 # The revision hash needs to be 7 characters? | |
43 TEST_262_ARCHIVE_REVISION = "26e6fd7" # This is the 2015-10-1 revision. | |
44 TEST_262_ARCHIVE_MD5 = "36fdd27f026f396234132fb5afdcfffb" | |
45 TEST_262_URL = "https://github.com/tc39/test262/tarball/%s" | |
46 TEST_262_HARNESS_FILES = ["sta.js", "assert.js"] | 42 TEST_262_HARNESS_FILES = ["sta.js", "assert.js"] |
47 | 43 |
48 TEST_262_SUITE_PATH = ["data", "test"] | 44 TEST_262_SUITE_PATH = ["data", "test"] |
49 TEST_262_HARNESS_PATH = ["data", "harness"] | 45 TEST_262_HARNESS_PATH = ["data", "harness"] |
50 TEST_262_TOOLS_PATH = ["data", "tools", "packaging"] | 46 TEST_262_TOOLS_PATH = ["data", "tools", "packaging"] |
51 | 47 |
52 ALL_VARIANT_FLAGS_STRICT = dict( | 48 ALL_VARIANT_FLAGS_STRICT = dict( |
53 (v, [flags + ["--use-strict"] for flags in flag_sets]) | 49 (v, [flags + ["--use-strict"] for flags in flag_sets]) |
54 for v, flag_sets in testsuite.ALL_VARIANT_FLAGS.iteritems() | 50 for v, flag_sets in testsuite.ALL_VARIANT_FLAGS.iteritems() |
55 ) | 51 ) |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
189 return "FAILED!" in output.stdout | 185 return "FAILED!" in output.stdout |
190 | 186 |
191 def HasUnexpectedOutput(self, testcase): | 187 def HasUnexpectedOutput(self, testcase): |
192 outcome = self.GetOutcome(testcase) | 188 outcome = self.GetOutcome(testcase) |
193 if (statusfile.FAIL_SLOPPY in testcase.outcomes and | 189 if (statusfile.FAIL_SLOPPY in testcase.outcomes and |
194 "--use-strict" not in testcase.flags): | 190 "--use-strict" not in testcase.flags): |
195 return outcome != statusfile.FAIL | 191 return outcome != statusfile.FAIL |
196 return not outcome in (testcase.outcomes or [statusfile.PASS]) | 192 return not outcome in (testcase.outcomes or [statusfile.PASS]) |
197 | 193 |
198 def DownloadData(self): | 194 def DownloadData(self): |
199 revision = TEST_262_ARCHIVE_REVISION | 195 print "Test262 download is deprecated. It's part of DEPS." |
200 archive_url = TEST_262_URL % revision | 196 |
201 archive_name = os.path.join(self.root, "tc39-test262-%s.tar.gz" % revision) | 197 # Clean up old directories and archive files. |
202 directory_name = os.path.join(self.root, "data") | |
203 directory_old_name = os.path.join(self.root, "data.old") | 198 directory_old_name = os.path.join(self.root, "data.old") |
199 if os.path.exists(directory_old_name): | |
200 shutil.rmtree(directory_old_name) | |
204 | 201 |
205 # Clobber if the test is in an outdated state, i.e. if there are any other | |
206 # archive files present. | |
207 archive_files = [f for f in os.listdir(self.root) | 202 archive_files = [f for f in os.listdir(self.root) |
208 if f.startswith("tc39-test262-")] | 203 if f.startswith("tc39-test262-")] |
209 if (len(archive_files) > 1 or | 204 if len(archive_files) > 0: |
210 os.path.basename(archive_name) not in archive_files): | |
211 print "Clobber outdated test archives ..." | 205 print "Clobber outdated test archives ..." |
212 for f in archive_files: | 206 for f in archive_files: |
213 os.remove(os.path.join(self.root, f)) | 207 os.remove(os.path.join(self.root, f)) |
214 | 208 |
215 if not os.path.exists(archive_name): | |
216 print "Downloading test data from %s ..." % archive_url | |
217 utils.URLRetrieve(archive_url, archive_name) | |
218 if os.path.exists(directory_name): | |
219 if os.path.exists(directory_old_name): | |
220 shutil.rmtree(directory_old_name) | |
221 os.rename(directory_name, directory_old_name) | |
222 if not os.path.exists(directory_name): | |
223 print "Extracting test262-%s.tar.gz ..." % revision | |
224 md5 = hashlib.md5() | |
225 with open(archive_name, "rb") as f: | |
226 for chunk in iter(lambda: f.read(8192), ""): | |
227 md5.update(chunk) | |
228 print "MD5 hash is %s" % md5.hexdigest() | |
229 if md5.hexdigest() != TEST_262_ARCHIVE_MD5: | |
230 os.remove(archive_name) | |
231 print "MD5 expected %s" % TEST_262_ARCHIVE_MD5 | |
232 raise Exception("MD5 hash mismatch of test data file") | |
233 archive = tarfile.open(archive_name, "r:gz") | |
234 if sys.platform in ("win32", "cygwin"): | |
235 # Magic incantation to allow longer path names on Windows. | |
236 archive.extractall(u"\\\\?\\%s" % self.root) | |
237 else: | |
238 archive.extractall(self.root) | |
239 os.rename(os.path.join(self.root, "tc39-test262-%s" % revision), | |
240 directory_name) | |
241 | |
242 | 209 |
243 def GetSuite(name, root): | 210 def GetSuite(name, root): |
244 return Test262TestSuite(name, root) | 211 return Test262TestSuite(name, root) |
OLD | NEW |