| 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 19 matching lines...) Expand all Loading... |
| 30 import os | 30 import os |
| 31 import shutil | 31 import shutil |
| 32 import sys | 32 import sys |
| 33 import tarfile | 33 import tarfile |
| 34 import imp | 34 import imp |
| 35 | 35 |
| 36 from testrunner.local import testsuite | 36 from testrunner.local import testsuite |
| 37 from testrunner.local import utils | 37 from testrunner.local import utils |
| 38 from testrunner.objects import testcase | 38 from testrunner.objects import testcase |
| 39 | 39 |
| 40 TEST_262_ARCHIVE_REVISION = "e2b675f" # This is the 2014-10-15 revision. | 40 TEST_262_ARCHIVE_REVISION = "61113db" # This is the 2014-10-23 revision. |
| 41 TEST_262_ARCHIVE_MD5 = "98f4427d0c88628561cd1c0104cf0614" | 41 TEST_262_ARCHIVE_MD5 = "261e69b4a97a4bfc18225cf3938daf50" |
| 42 TEST_262_URL = "https://github.com/tc39/test262/tarball/%s" | 42 TEST_262_URL = "https://github.com/tc39/test262/tarball/%s" |
| 43 TEST_262_HARNESS_FILES = ["sta.js"] | 43 TEST_262_HARNESS_FILES = ["sta.js"] |
| 44 | 44 |
| 45 TEST_262_SUITE_PATH = ["data", "test", "suite"] | 45 TEST_262_SUITE_PATH = ["data", "test", "suite"] |
| 46 TEST_262_HARNESS_PATH = ["data", "test", "harness"] | 46 TEST_262_HARNESS_PATH = ["data", "test", "harness"] |
| 47 TEST_262_TOOLS_PATH = ["data", "tools", "packaging"] | 47 TEST_262_TOOLS_PATH = ["data", "tools", "packaging"] |
| 48 | 48 |
| 49 class Test262TestSuite(testsuite.TestSuite): | 49 class Test262TestSuite(testsuite.TestSuite): |
| 50 | 50 |
| 51 def __init__(self, name, root): | 51 def __init__(self, name, root): |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 if os.path.exists(directory_name): | 140 if os.path.exists(directory_name): |
| 141 if os.path.exists(directory_old_name): | 141 if os.path.exists(directory_old_name): |
| 142 shutil.rmtree(directory_old_name) | 142 shutil.rmtree(directory_old_name) |
| 143 os.rename(directory_name, directory_old_name) | 143 os.rename(directory_name, directory_old_name) |
| 144 if not os.path.exists(directory_name): | 144 if not os.path.exists(directory_name): |
| 145 print "Extracting test262-%s.tar.gz ..." % revision | 145 print "Extracting test262-%s.tar.gz ..." % revision |
| 146 md5 = hashlib.md5() | 146 md5 = hashlib.md5() |
| 147 with open(archive_name, "rb") as f: | 147 with open(archive_name, "rb") as f: |
| 148 for chunk in iter(lambda: f.read(8192), ""): | 148 for chunk in iter(lambda: f.read(8192), ""): |
| 149 md5.update(chunk) | 149 md5.update(chunk) |
| 150 print "MD5 hash is %s" % md5.hexdigest() |
| 150 if md5.hexdigest() != TEST_262_ARCHIVE_MD5: | 151 if md5.hexdigest() != TEST_262_ARCHIVE_MD5: |
| 151 os.remove(archive_name) | 152 os.remove(archive_name) |
| 152 raise Exception("Hash mismatch of test data file") | 153 print "MD5 expected %s" % TEST_262_ARCHIVE_MD5 |
| 154 raise Exception("MD5 hash mismatch of test data file") |
| 153 archive = tarfile.open(archive_name, "r:gz") | 155 archive = tarfile.open(archive_name, "r:gz") |
| 154 if sys.platform in ("win32", "cygwin"): | 156 if sys.platform in ("win32", "cygwin"): |
| 155 # Magic incantation to allow longer path names on Windows. | 157 # Magic incantation to allow longer path names on Windows. |
| 156 archive.extractall(u"\\\\?\\%s" % self.root) | 158 archive.extractall(u"\\\\?\\%s" % self.root) |
| 157 else: | 159 else: |
| 158 archive.extractall(self.root) | 160 archive.extractall(self.root) |
| 159 os.rename(os.path.join(self.root, "tc39-test262-%s" % revision), | 161 os.rename(os.path.join(self.root, "tc39-test262-%s" % revision), |
| 160 directory_name) | 162 directory_name) |
| 161 | 163 |
| 162 | 164 |
| 163 def GetSuite(name, root): | 165 def GetSuite(name, root): |
| 164 return Test262TestSuite(name, root) | 166 return Test262TestSuite(name, root) |
| OLD | NEW |