OLD | NEW |
---|---|
1 # Copyright 2014 the V8 project authors. All rights reserved. | 1 # Copyright 2014 the V8 project authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 import hashlib | 6 import hashlib |
7 import os | 7 import os |
8 import shutil | 8 import shutil |
9 import sys | 9 import sys |
10 import tarfile | 10 import tarfile |
11 import imp | 11 import imp |
12 | 12 |
13 from testrunner.local import testsuite | 13 from testrunner.local import testsuite |
14 from testrunner.local import utils | 14 from testrunner.local import utils |
15 from testrunner.objects import testcase | 15 from testrunner.objects import testcase |
16 | 16 |
17 SIMDJS_ARCHIVE_REVISION = "07e2713e0c9ea19feb0732d5bd84770c87310d79" | 17 SIMDJS_ARCHIVE_REVISION = "631f1ebf046e60e67138c21bdafdf8624903d87b" |
bbudge
2015/07/20 23:39:40
I'll have to update this since the current polyfil
| |
18 SIMDJS_ARCHIVE_MD5 = "cf6bddf99f18800b68e782054268ee3c" | 18 SIMDJS_ARCHIVE_MD5 = "9bdd1a7acb8090e90c84a97f5575a67a" |
19 SIMDJS_URL = ( | 19 SIMDJS_URL = ("https://github.com/tc39/ecmascript_simd/archive/%s.tar.gz") |
20 "https://github.com/johnmccutchan/ecmascript_simd/archive/%s.tar.gz") | |
21 | 20 |
22 SIMDJS_SUITE_PATH = ["data", "src"] | 21 SIMDJS_SUITE_PATH = ["data", "src"] |
23 | 22 |
24 | 23 |
25 class SimdJsTestSuite(testsuite.TestSuite): | 24 class SimdJsTestSuite(testsuite.TestSuite): |
26 | 25 |
27 def __init__(self, name, root): | 26 def __init__(self, name, root): |
28 super(SimdJsTestSuite, self).__init__(name, root) | 27 super(SimdJsTestSuite, self).__init__(name, root) |
29 self.testroot = os.path.join(self.root, *SIMDJS_SUITE_PATH) | 28 self.testroot = os.path.join(self.root, *SIMDJS_SUITE_PATH) |
30 self.ParseTestRecord = None | 29 self.ParseTestRecord = None |
(...skipping 27 matching lines...) Expand all Loading... | |
58 return False | 57 return False |
59 | 58 |
60 def IsFailureOutput(self, output, testpath): | 59 def IsFailureOutput(self, output, testpath): |
61 if output.exit_code != 0: | 60 if output.exit_code != 0: |
62 return True | 61 return True |
63 return "FAILED!" in output.stdout | 62 return "FAILED!" in output.stdout |
64 | 63 |
65 def DownloadData(self): | 64 def DownloadData(self): |
66 revision = SIMDJS_ARCHIVE_REVISION | 65 revision = SIMDJS_ARCHIVE_REVISION |
67 archive_url = SIMDJS_URL % revision | 66 archive_url = SIMDJS_URL % revision |
67 | |
bbudge
2015/07/20 23:39:40
Incorporating some changes from Brad Nelson's CL t
bbudge
2015/07/21 00:37:21
Brad's CL: https://codereview.chromium.org/1240453
| |
68 archive_name = os.path.join( | 68 archive_name = os.path.join( |
69 self.root, "ecmascript_simd-%s.tar.gz" % revision) | 69 self.root, "ecmascript_simd-%s.tar.gz" % revision) |
70 directory_name = os.path.join(self.root, "data") | 70 directory_name = os.path.join(self.root, "data") |
71 directory_old_name = os.path.join(self.root, "data.old") | 71 directory_old_name = os.path.join(self.root, "data.old") |
72 versionfile = os.path.join(self.root, "CHECKED_OUT_VERSION") | |
73 | |
74 checked_out_version = None | |
75 checked_out_url = None | |
76 checked_out_revision = None | |
77 if os.path.exists(versionfile): | |
78 with open(versionfile) as f: | |
79 try: | |
80 (checked_out_version, | |
81 checked_out_url, | |
82 checked_out_revision) = f.read().splitlines() | |
83 except ValueError: | |
84 pass | |
85 if (checked_out_version != SIMDJS_ARCHIVE_MD5 or | |
86 checked_out_url != archive_url or | |
87 checked_out_revision != revision): | |
88 if os.path.exists(archive_name): | |
89 os.remove(archive_name) | |
90 | |
72 if not os.path.exists(archive_name): | 91 if not os.path.exists(archive_name): |
73 print "Downloading test data from %s ..." % archive_url | 92 print "Downloading test data from %s ..." % archive_url |
74 utils.URLRetrieve(archive_url, archive_name) | 93 utils.URLRetrieve(archive_url, archive_name) |
75 if os.path.exists(directory_name): | 94 if os.path.exists(directory_name): |
76 if os.path.exists(directory_old_name): | 95 if os.path.exists(directory_old_name): |
77 shutil.rmtree(directory_old_name) | 96 shutil.rmtree(directory_old_name) |
78 os.rename(directory_name, directory_old_name) | 97 os.rename(directory_name, directory_old_name) |
79 if not os.path.exists(directory_name): | 98 if not os.path.exists(directory_name): |
80 print "Extracting ecmascript_simd-%s.tar.gz ..." % revision | 99 print "Extracting ecmascript_simd-%s.tar.gz ..." % revision |
81 md5 = hashlib.md5() | 100 md5 = hashlib.md5() |
82 with open(archive_name, "rb") as f: | 101 with open(archive_name, "rb") as f: |
83 for chunk in iter(lambda: f.read(8192), ""): | 102 for chunk in iter(lambda: f.read(8192), ""): |
84 md5.update(chunk) | 103 md5.update(chunk) |
85 print "MD5 hash is %s" % md5.hexdigest() | 104 print "MD5 hash is %s" % md5.hexdigest() |
86 if md5.hexdigest() != SIMDJS_ARCHIVE_MD5: | 105 if md5.hexdigest() != SIMDJS_ARCHIVE_MD5: |
87 os.remove(archive_name) | 106 os.remove(archive_name) |
88 print "MD5 expected %s" % SIMDJS_ARCHIVE_MD5 | 107 print "MD5 expected %s" % SIMDJS_ARCHIVE_MD5 |
89 raise Exception("MD5 hash mismatch of test data file") | 108 raise Exception("MD5 hash mismatch of test data file") |
90 archive = tarfile.open(archive_name, "r:gz") | 109 archive = tarfile.open(archive_name, "r:gz") |
91 if sys.platform in ("win32", "cygwin"): | 110 if sys.platform in ("win32", "cygwin"): |
92 # Magic incantation to allow longer path names on Windows. | 111 # Magic incantation to allow longer path names on Windows. |
93 archive.extractall(u"\\\\?\\%s" % self.root) | 112 archive.extractall(u"\\\\?\\%s" % self.root) |
94 else: | 113 else: |
95 archive.extractall(self.root) | 114 archive.extractall(self.root) |
96 os.rename(os.path.join(self.root, "ecmascript_simd-%s" % revision), | 115 os.rename(os.path.join(self.root, "ecmascript_simd-%s" % revision), |
97 directory_name) | 116 directory_name) |
98 | 117 |
118 with open(versionfile, "w") as f: | |
119 f.write(SIMDJS_ARCHIVE_MD5 + '\n') | |
120 f.write(archive_url + '\n') | |
121 f.write(revision + '\n') | |
122 | |
99 | 123 |
100 def GetSuite(name, root): | 124 def GetSuite(name, root): |
101 return SimdJsTestSuite(name, root) | 125 return SimdJsTestSuite(name, root) |
OLD | NEW |