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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 test = Test262TestCase(join(root, file), test_path, self.context, | 97 test = Test262TestCase(join(root, file), test_path, self.context, |
98 self.root, mode, harness) | 98 self.root, mode, harness) |
99 tests.append(test) | 99 tests.append(test) |
100 return tests | 100 return tests |
101 | 101 |
102 def DownloadData(self): | 102 def DownloadData(self): |
103 revision = TEST_262_ARCHIVE_REVISION | 103 revision = TEST_262_ARCHIVE_REVISION |
104 archive_url = TEST_262_URL % revision | 104 archive_url = TEST_262_URL % revision |
105 archive_name = join(self.root, 'test262-%s.tar.bz2' % revision) | 105 archive_name = join(self.root, 'test262-%s.tar.bz2' % revision) |
106 directory_name = join(self.root, 'data') | 106 directory_name = join(self.root, 'data') |
| 107 directory_old_name = join(self.root, 'data.old') |
107 if not exists(archive_name): | 108 if not exists(archive_name): |
108 print "Downloading test data from %s ..." % archive_url | 109 print "Downloading test data from %s ..." % archive_url |
109 urllib.urlretrieve(archive_url, archive_name) | 110 urllib.urlretrieve(archive_url, archive_name) |
| 111 if exists(directory_name): |
| 112 os.rename(directory_name, directory_old_name) |
110 if not exists(directory_name): | 113 if not exists(directory_name): |
111 print "Extracting test262-%s.tar.bz2 ..." % revision | 114 print "Extracting test262-%s.tar.bz2 ..." % revision |
112 md5 = hashlib.md5() | 115 md5 = hashlib.md5() |
113 with open(archive_name,'rb') as f: | 116 with open(archive_name,'rb') as f: |
114 for chunk in iter(lambda: f.read(8192), ''): | 117 for chunk in iter(lambda: f.read(8192), ''): |
115 md5.update(chunk) | 118 md5.update(chunk) |
116 if md5.hexdigest() != TEST_262_ARCHIVE_MD5: | 119 if md5.hexdigest() != TEST_262_ARCHIVE_MD5: |
| 120 os.remove(archive_name) |
117 raise Exception("Hash mismatch of test data file") | 121 raise Exception("Hash mismatch of test data file") |
118 archive = tarfile.open(archive_name, 'r:bz2') | 122 archive = tarfile.open(archive_name, 'r:bz2') |
119 archive.extractall(join(self.root)) | 123 archive.extractall(join(self.root)) |
120 os.rename(join(self.root, 'test262-%s' % revision), directory_name) | 124 os.rename(join(self.root, 'test262-%s' % revision), directory_name) |
121 | 125 |
122 def GetBuildRequirements(self): | 126 def GetBuildRequirements(self): |
123 return ['d8'] | 127 return ['d8'] |
124 | 128 |
125 def GetTestStatus(self, sections, defs): | 129 def GetTestStatus(self, sections, defs): |
126 status_file = join(self.root, 'test262.status') | 130 status_file = join(self.root, 'test262.status') |
127 if exists(status_file): | 131 if exists(status_file): |
128 test.ReadConfigurationInto(status_file, sections, defs) | 132 test.ReadConfigurationInto(status_file, sections, defs) |
129 | 133 |
130 | 134 |
131 def GetConfiguration(context, root): | 135 def GetConfiguration(context, root): |
132 return Test262TestConfiguration(context, root) | 136 return Test262TestConfiguration(context, root) |
OLD | NEW |