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 16 matching lines...) Expand all Loading... |
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 tarfile | 34 import tarfile |
35 | 35 |
36 | 36 |
37 TEST_262_ARCHIVE_REVISION = '3a890174343c' # This is the r309 revision. | 37 TEST_262_ARCHIVE_REVISION = 'fb327c439e20' # This is the r334 revision. |
38 TEST_262_ARCHIVE_MD5 = 'be5d4cfbe69cef70430907b8f3a92b50' | 38 TEST_262_ARCHIVE_MD5 = '307acd166ec34629592f240dc12d57ed' |
39 TEST_262_URL = 'http://hg.ecmascript.org/tests/test262/archive/%s.tar.bz2' | 39 TEST_262_URL = 'http://hg.ecmascript.org/tests/test262/archive/%s.tar.bz2' |
40 TEST_262_HARNESS = ['sta.js'] | 40 TEST_262_HARNESS = ['sta.js'] |
41 | 41 |
42 | 42 |
43 class Test262TestCase(test.TestCase): | 43 class Test262TestCase(test.TestCase): |
44 | 44 |
45 def __init__(self, filename, path, context, root, mode, framework): | 45 def __init__(self, filename, path, context, root, mode, framework): |
46 super(Test262TestCase, self).__init__(context, path, mode) | 46 super(Test262TestCase, self).__init__(context, path, mode) |
47 self.filename = filename | 47 self.filename = filename |
48 self.framework = framework | 48 self.framework = framework |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 if not exists(archive_name): | 107 if not exists(archive_name): |
108 print "Downloading test data from %s ..." % archive_url | 108 print "Downloading test data from %s ..." % archive_url |
109 urllib.urlretrieve(archive_url, archive_name) | 109 urllib.urlretrieve(archive_url, archive_name) |
110 if not exists(directory_name): | 110 if not exists(directory_name): |
111 print "Extracting test262-%s.tar.bz2 ..." % revision | 111 print "Extracting test262-%s.tar.bz2 ..." % revision |
112 md5 = hashlib.md5() | 112 md5 = hashlib.md5() |
113 with open(archive_name,'rb') as f: | 113 with open(archive_name,'rb') as f: |
114 for chunk in iter(lambda: f.read(8192), ''): | 114 for chunk in iter(lambda: f.read(8192), ''): |
115 md5.update(chunk) | 115 md5.update(chunk) |
116 if md5.hexdigest() != TEST_262_ARCHIVE_MD5: | 116 if md5.hexdigest() != TEST_262_ARCHIVE_MD5: |
| 117 os.remove(archive_name) |
117 raise Exception("Hash mismatch of test data file") | 118 raise Exception("Hash mismatch of test data file") |
118 archive = tarfile.open(archive_name, 'r:bz2') | 119 archive = tarfile.open(archive_name, 'r:bz2') |
119 archive.extractall(join(self.root)) | 120 archive.extractall(join(self.root)) |
120 os.rename(join(self.root, 'test262-%s' % revision), directory_name) | 121 os.rename(join(self.root, 'test262-%s' % revision), directory_name) |
121 | 122 |
122 def GetBuildRequirements(self): | 123 def GetBuildRequirements(self): |
123 return ['d8'] | 124 return ['d8'] |
124 | 125 |
125 def GetTestStatus(self, sections, defs): | 126 def GetTestStatus(self, sections, defs): |
126 status_file = join(self.root, 'test262.status') | 127 status_file = join(self.root, 'test262.status') |
127 if exists(status_file): | 128 if exists(status_file): |
128 test.ReadConfigurationInto(status_file, sections, defs) | 129 test.ReadConfigurationInto(status_file, sections, defs) |
129 | 130 |
130 | 131 |
131 def GetConfiguration(context, root): | 132 def GetConfiguration(context, root): |
132 return Test262TestConfiguration(context, root) | 133 return Test262TestConfiguration(context, root) |
OLD | NEW |