| 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 test | 29 import test |
| 30 import os | 30 import os |
| 31 from os.path import join, exists | 31 from os.path import join, exists |
| 32 import urllib | 32 import urllib |
| 33 import hashlib | 33 import hashlib |
| 34 import sys |
| 34 import tarfile | 35 import tarfile |
| 35 | 36 |
| 36 | 37 |
| 37 TEST_262_ARCHIVE_REVISION = 'fb327c439e20' # This is the r334 revision. | 38 TEST_262_ARCHIVE_REVISION = 'fb327c439e20' # This is the r334 revision. |
| 38 TEST_262_ARCHIVE_MD5 = '307acd166ec34629592f240dc12d57ed' | 39 TEST_262_ARCHIVE_MD5 = '307acd166ec34629592f240dc12d57ed' |
| 39 TEST_262_URL = 'http://hg.ecmascript.org/tests/test262/archive/%s.tar.bz2' | 40 TEST_262_URL = 'http://hg.ecmascript.org/tests/test262/archive/%s.tar.bz2' |
| 40 TEST_262_HARNESS = ['sta.js'] | 41 TEST_262_HARNESS = ['sta.js'] |
| 41 | 42 |
| 42 | 43 |
| 43 class Test262TestCase(test.TestCase): | 44 class Test262TestCase(test.TestCase): |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 if not exists(directory_name): | 114 if not exists(directory_name): |
| 114 print "Extracting test262-%s.tar.bz2 ..." % revision | 115 print "Extracting test262-%s.tar.bz2 ..." % revision |
| 115 md5 = hashlib.md5() | 116 md5 = hashlib.md5() |
| 116 with open(archive_name,'rb') as f: | 117 with open(archive_name,'rb') as f: |
| 117 for chunk in iter(lambda: f.read(8192), ''): | 118 for chunk in iter(lambda: f.read(8192), ''): |
| 118 md5.update(chunk) | 119 md5.update(chunk) |
| 119 if md5.hexdigest() != TEST_262_ARCHIVE_MD5: | 120 if md5.hexdigest() != TEST_262_ARCHIVE_MD5: |
| 120 os.remove(archive_name) | 121 os.remove(archive_name) |
| 121 raise Exception("Hash mismatch of test data file") | 122 raise Exception("Hash mismatch of test data file") |
| 122 archive = tarfile.open(archive_name, 'r:bz2') | 123 archive = tarfile.open(archive_name, 'r:bz2') |
| 123 archive.extractall(join(self.root)) | 124 if sys.platform in ('win32', 'cygwin'): |
| 125 # Magic incantation to allow longer path names on Windows. |
| 126 archive.extractall(u'\\\\?\\%s' % self.root) |
| 127 else: |
| 128 archive.extractall(self.root) |
| 124 os.rename(join(self.root, 'test262-%s' % revision), directory_name) | 129 os.rename(join(self.root, 'test262-%s' % revision), directory_name) |
| 125 | 130 |
| 126 def GetBuildRequirements(self): | 131 def GetBuildRequirements(self): |
| 127 return ['d8'] | 132 return ['d8'] |
| 128 | 133 |
| 129 def GetTestStatus(self, sections, defs): | 134 def GetTestStatus(self, sections, defs): |
| 130 status_file = join(self.root, 'test262.status') | 135 status_file = join(self.root, 'test262.status') |
| 131 if exists(status_file): | 136 if exists(status_file): |
| 132 test.ReadConfigurationInto(status_file, sections, defs) | 137 test.ReadConfigurationInto(status_file, sections, defs) |
| 133 | 138 |
| 134 | 139 |
| 135 def GetConfiguration(context, root): | 140 def GetConfiguration(context, root): |
| 136 return Test262TestConfiguration(context, root) | 141 return Test262TestConfiguration(context, root) |
| OLD | NEW |