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