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