| 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 86 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: |
| 117 os.remove(archive_name) | 120 os.remove(archive_name) |
| 118 raise Exception("Hash mismatch of test data file") | 121 raise Exception("Hash mismatch of test data file") |
| 119 archive = tarfile.open(archive_name, 'r:bz2') | 122 archive = tarfile.open(archive_name, 'r:bz2') |
| 120 archive.extractall(join(self.root)) | 123 archive.extractall(join(self.root)) |
| 121 os.rename(join(self.root, 'test262-%s' % revision), directory_name) | 124 os.rename(join(self.root, 'test262-%s' % revision), directory_name) |
| 122 | 125 |
| 123 def GetBuildRequirements(self): | 126 def GetBuildRequirements(self): |
| 124 return ['d8'] | 127 return ['d8'] |
| 125 | 128 |
| 126 def GetTestStatus(self, sections, defs): | 129 def GetTestStatus(self, sections, defs): |
| 127 status_file = join(self.root, 'test262.status') | 130 status_file = join(self.root, 'test262.status') |
| 128 if exists(status_file): | 131 if exists(status_file): |
| 129 test.ReadConfigurationInto(status_file, sections, defs) | 132 test.ReadConfigurationInto(status_file, sections, defs) |
| 130 | 133 |
| 131 | 134 |
| 132 def GetConfiguration(context, root): | 135 def GetConfiguration(context, root): |
| 133 return Test262TestConfiguration(context, root) | 136 return Test262TestConfiguration(context, root) |
| OLD | NEW |