| 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 13 matching lines...) Expand all Loading... |
| 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 |
| 30 import os | 30 import os |
| 31 import shutil | 31 import shutil |
| 32 import sys | 32 import sys |
| 33 import tarfile | 33 import tarfile |
| 34 import urllib | |
| 35 | 34 |
| 36 from testrunner.local import testsuite | 35 from testrunner.local import testsuite |
| 36 from testrunner.local import utils |
| 37 from testrunner.objects import testcase | 37 from testrunner.objects import testcase |
| 38 | 38 |
| 39 | 39 |
| 40 TEST_262_ARCHIVE_REVISION = "fbba29f" # This is the r365 revision. | 40 TEST_262_ARCHIVE_REVISION = "fbba29f" # This is the r365 revision. |
| 41 TEST_262_ARCHIVE_MD5 = "e1ff0db438cc12de8fb6da80621b4ef6" | 41 TEST_262_ARCHIVE_MD5 = "e1ff0db438cc12de8fb6da80621b4ef6" |
| 42 TEST_262_URL = "https://github.com/tc39/test262/tarball/%s" | 42 TEST_262_URL = "https://github.com/tc39/test262/tarball/%s" |
| 43 TEST_262_HARNESS = ["sta.js", "testBuiltInObject.js", "testIntl.js"] | 43 TEST_262_HARNESS = ["sta.js", "testBuiltInObject.js", "testIntl.js"] |
| 44 | 44 |
| 45 | 45 |
| 46 class Test262TestSuite(testsuite.TestSuite): | 46 class Test262TestSuite(testsuite.TestSuite): |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 return "FAILED!" in output.stdout | 90 return "FAILED!" in output.stdout |
| 91 | 91 |
| 92 def DownloadData(self): | 92 def DownloadData(self): |
| 93 revision = TEST_262_ARCHIVE_REVISION | 93 revision = TEST_262_ARCHIVE_REVISION |
| 94 archive_url = TEST_262_URL % revision | 94 archive_url = TEST_262_URL % revision |
| 95 archive_name = os.path.join(self.root, "tc39-test262-%s.tar.gz" % revision) | 95 archive_name = os.path.join(self.root, "tc39-test262-%s.tar.gz" % revision) |
| 96 directory_name = os.path.join(self.root, "data") | 96 directory_name = os.path.join(self.root, "data") |
| 97 directory_old_name = os.path.join(self.root, "data.old") | 97 directory_old_name = os.path.join(self.root, "data.old") |
| 98 if not os.path.exists(archive_name): | 98 if not os.path.exists(archive_name): |
| 99 print "Downloading test data from %s ..." % archive_url | 99 print "Downloading test data from %s ..." % archive_url |
| 100 urllib.urlretrieve(archive_url, archive_name) | 100 utils.URLRetrieve(archive_url, archive_name) |
| 101 if os.path.exists(directory_name): | 101 if os.path.exists(directory_name): |
| 102 if os.path.exists(directory_old_name): | 102 if os.path.exists(directory_old_name): |
| 103 shutil.rmtree(directory_old_name) | 103 shutil.rmtree(directory_old_name) |
| 104 os.rename(directory_name, directory_old_name) | 104 os.rename(directory_name, directory_old_name) |
| 105 if not os.path.exists(directory_name): | 105 if not os.path.exists(directory_name): |
| 106 print "Extracting test262-%s.tar.gz ..." % revision | 106 print "Extracting test262-%s.tar.gz ..." % revision |
| 107 md5 = hashlib.md5() | 107 md5 = hashlib.md5() |
| 108 with open(archive_name, "rb") as f: | 108 with open(archive_name, "rb") as f: |
| 109 for chunk in iter(lambda: f.read(8192), ""): | 109 for chunk in iter(lambda: f.read(8192), ""): |
| 110 md5.update(chunk) | 110 md5.update(chunk) |
| 111 if md5.hexdigest() != TEST_262_ARCHIVE_MD5: | 111 if md5.hexdigest() != TEST_262_ARCHIVE_MD5: |
| 112 os.remove(archive_name) | 112 os.remove(archive_name) |
| 113 raise Exception("Hash mismatch of test data file") | 113 raise Exception("Hash mismatch of test data file") |
| 114 archive = tarfile.open(archive_name, "r:gz") | 114 archive = tarfile.open(archive_name, "r:gz") |
| 115 if sys.platform in ("win32", "cygwin"): | 115 if sys.platform in ("win32", "cygwin"): |
| 116 # Magic incantation to allow longer path names on Windows. | 116 # Magic incantation to allow longer path names on Windows. |
| 117 archive.extractall(u"\\\\?\\%s" % self.root) | 117 archive.extractall(u"\\\\?\\%s" % self.root) |
| 118 else: | 118 else: |
| 119 archive.extractall(self.root) | 119 archive.extractall(self.root) |
| 120 os.rename(os.path.join(self.root, "tc39-test262-%s" % revision), | 120 os.rename(os.path.join(self.root, "tc39-test262-%s" % revision), |
| 121 directory_name) | 121 directory_name) |
| 122 | 122 |
| 123 | 123 |
| 124 def GetSuite(name, root): | 124 def GetSuite(name, root): |
| 125 return Test262TestSuite(name, root) | 125 return Test262TestSuite(name, root) |
| OLD | NEW |