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 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 return False | 58 return False |
59 | 59 |
60 def IsFailureOutput(self, output, testpath): | 60 def IsFailureOutput(self, output, testpath): |
61 if output.exit_code != 0: | 61 if output.exit_code != 0: |
62 return True | 62 return True |
63 return "FAILED!" in output.stdout | 63 return "FAILED!" in output.stdout |
64 | 64 |
65 def DownloadData(self): | 65 def DownloadData(self): |
66 revision = SIMDJS_ARCHIVE_REVISION | 66 revision = SIMDJS_ARCHIVE_REVISION |
67 archive_url = SIMDJS_URL % revision | 67 archive_url = SIMDJS_URL % revision |
68 | |
68 archive_name = os.path.join( | 69 archive_name = os.path.join( |
69 self.root, "ecmascript_simd-%s.tar.gz" % revision) | 70 self.root, "ecmascript_simd-%s.tar.gz" % revision) |
70 directory_name = os.path.join(self.root, "data") | 71 directory_name = os.path.join(self.root, "data") |
71 directory_old_name = os.path.join(self.root, "data.old") | 72 directory_old_name = os.path.join(self.root, "data.old") |
73 versionfile = os.path.join(self.root, "CHECKED_OUT_VERSION") | |
74 | |
75 checked_out_version = None | |
76 checked_out_url = None | |
77 checked_out_revision = None | |
78 if os.path.exists(versionfile): | |
79 with open(versionfile) as f: | |
80 try: | |
81 (checked_out_version, | |
82 checked_out_url, | |
83 checked_out_revision) = f.read().splitlines() | |
84 except ValueError: | |
85 pass | |
86 if (checked_out_version != SIMDJS_ARCHIVE_MD5 or | |
87 checked_out_url != archive_url or | |
88 checked_out_revision != revision): | |
Michael Achenbach
2015/07/21 06:58:17
Please add a print statement here that logs what's
bradn
2015/07/21 18:37:19
Done.
| |
89 if os.path.exists(archive_name): | |
90 os.remove(archive_name) | |
91 | |
72 if not os.path.exists(archive_name): | 92 if not os.path.exists(archive_name): |
73 print "Downloading test data from %s ..." % archive_url | 93 print "Downloading test data from %s ..." % archive_url |
74 utils.URLRetrieve(archive_url, archive_name) | 94 utils.URLRetrieve(archive_url, archive_name) |
75 if os.path.exists(directory_name): | 95 if os.path.exists(directory_name): |
76 if os.path.exists(directory_old_name): | 96 if os.path.exists(directory_old_name): |
77 shutil.rmtree(directory_old_name) | 97 shutil.rmtree(directory_old_name) |
78 os.rename(directory_name, directory_old_name) | 98 os.rename(directory_name, directory_old_name) |
79 if not os.path.exists(directory_name): | 99 if not os.path.exists(directory_name): |
80 print "Extracting ecmascript_simd-%s.tar.gz ..." % revision | 100 print "Extracting ecmascript_simd-%s.tar.gz ..." % revision |
81 md5 = hashlib.md5() | 101 md5 = hashlib.md5() |
82 with open(archive_name, "rb") as f: | 102 with open(archive_name, "rb") as f: |
83 for chunk in iter(lambda: f.read(8192), ""): | 103 for chunk in iter(lambda: f.read(8192), ""): |
84 md5.update(chunk) | 104 md5.update(chunk) |
85 print "MD5 hash is %s" % md5.hexdigest() | 105 print "MD5 hash is %s" % md5.hexdigest() |
86 if md5.hexdigest() != SIMDJS_ARCHIVE_MD5: | 106 if md5.hexdigest() != SIMDJS_ARCHIVE_MD5: |
87 os.remove(archive_name) | 107 os.remove(archive_name) |
88 print "MD5 expected %s" % SIMDJS_ARCHIVE_MD5 | 108 print "MD5 expected %s" % SIMDJS_ARCHIVE_MD5 |
89 raise Exception("MD5 hash mismatch of test data file") | 109 raise Exception("MD5 hash mismatch of test data file") |
90 archive = tarfile.open(archive_name, "r:gz") | 110 archive = tarfile.open(archive_name, "r:gz") |
91 if sys.platform in ("win32", "cygwin"): | 111 if sys.platform in ("win32", "cygwin"): |
92 # Magic incantation to allow longer path names on Windows. | 112 # Magic incantation to allow longer path names on Windows. |
93 archive.extractall(u"\\\\?\\%s" % self.root) | 113 archive.extractall(u"\\\\?\\%s" % self.root) |
94 else: | 114 else: |
95 archive.extractall(self.root) | 115 archive.extractall(self.root) |
96 os.rename(os.path.join(self.root, "ecmascript_simd-%s" % revision), | 116 os.rename(os.path.join(self.root, "ecmascript_simd-%s" % revision), |
97 directory_name) | 117 directory_name) |
98 | 118 |
119 with open(versionfile, "w") as f: | |
120 f.write(SIMDJS_ARCHIVE_MD5 + '\n') | |
121 f.write(archive_url + '\n') | |
122 f.write(revision + '\n') | |
123 | |
99 | 124 |
100 def GetSuite(name, root): | 125 def GetSuite(name, root): |
101 return SimdJsTestSuite(name, root) | 126 return SimdJsTestSuite(name, root) |
OLD | NEW |