Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: test/simdjs/testcfg.py

Issue 1240453003: Make simdjs tests redownload on a revision change. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
69 archive_prefix = "ecmascript_simd-"
68 archive_name = os.path.join( 70 archive_name = os.path.join(
69 self.root, "ecmascript_simd-%s.tar.gz" % revision) 71 self.root, "%s%s.tar.gz" % (archive_prefix, revision))
70 directory_name = os.path.join(self.root, "data") 72 directory_name = os.path.join(self.root, "data")
71 directory_old_name = os.path.join(self.root, "data.old") 73 directory_old_name = os.path.join(self.root, "data.old")
74 versionfile = os.path.join(self.root, "CHECKED_OUT_VERSION")
Michael Achenbach 2015/07/23 21:05:13 Maybe this file needs to be added to the .gitignor
75
76 checked_out_version = None
77 checked_out_url = None
78 checked_out_revision = None
79 if os.path.exists(versionfile):
80 with open(versionfile) as f:
81 try:
82 (checked_out_version,
83 checked_out_url,
84 checked_out_revision) = f.read().splitlines()
85 except ValueError:
86 pass
87 if (checked_out_version != SIMDJS_ARCHIVE_MD5 or
88 checked_out_url != archive_url or
89 checked_out_revision != revision):
90 if os.path.exists(archive_name):
91 print "Clobbering %s because CHECK_OUT_VERSION is out of date" % (
92 archive_name)
93 os.remove(archive_name)
94
95 # Clobber if the test is in an outdated state, i.e. if there are any other
96 # archive files present.
97 archive_files = [f for f in os.listdir(self.root)
98 if f.startswith(archive_prefix)]
99 if (len(archive_files) > 1 or
100 os.path.basename(archive_name) not in archive_files):
101 print "Clobber outdated test archives ..."
102 for f in archive_files:
103 print "Removing %s" % f
104 os.remove(os.path.join(self.root, f))
105
72 if not os.path.exists(archive_name): 106 if not os.path.exists(archive_name):
73 print "Downloading test data from %s ..." % archive_url 107 print "Downloading test data from %s ..." % archive_url
74 utils.URLRetrieve(archive_url, archive_name) 108 utils.URLRetrieve(archive_url, archive_name)
75 if os.path.exists(directory_name): 109 if os.path.exists(directory_name):
76 if os.path.exists(directory_old_name): 110 if os.path.exists(directory_old_name):
77 shutil.rmtree(directory_old_name) 111 shutil.rmtree(directory_old_name)
78 os.rename(directory_name, directory_old_name) 112 os.rename(directory_name, directory_old_name)
79 if not os.path.exists(directory_name): 113 if not os.path.exists(directory_name):
80 print "Extracting ecmascript_simd-%s.tar.gz ..." % revision 114 print "Extracting ecmascript_simd-%s.tar.gz ..." % revision
81 md5 = hashlib.md5() 115 md5 = hashlib.md5()
82 with open(archive_name, "rb") as f: 116 with open(archive_name, "rb") as f:
83 for chunk in iter(lambda: f.read(8192), ""): 117 for chunk in iter(lambda: f.read(8192), ""):
84 md5.update(chunk) 118 md5.update(chunk)
85 print "MD5 hash is %s" % md5.hexdigest() 119 print "MD5 hash is %s" % md5.hexdigest()
86 if md5.hexdigest() != SIMDJS_ARCHIVE_MD5: 120 if md5.hexdigest() != SIMDJS_ARCHIVE_MD5:
87 os.remove(archive_name) 121 os.remove(archive_name)
88 print "MD5 expected %s" % SIMDJS_ARCHIVE_MD5 122 print "MD5 expected %s" % SIMDJS_ARCHIVE_MD5
89 raise Exception("MD5 hash mismatch of test data file") 123 raise Exception("MD5 hash mismatch of test data file")
90 archive = tarfile.open(archive_name, "r:gz") 124 archive = tarfile.open(archive_name, "r:gz")
91 if sys.platform in ("win32", "cygwin"): 125 if sys.platform in ("win32", "cygwin"):
92 # Magic incantation to allow longer path names on Windows. 126 # Magic incantation to allow longer path names on Windows.
93 archive.extractall(u"\\\\?\\%s" % self.root) 127 archive.extractall(u"\\\\?\\%s" % self.root)
94 else: 128 else:
95 archive.extractall(self.root) 129 archive.extractall(self.root)
96 os.rename(os.path.join(self.root, "ecmascript_simd-%s" % revision), 130 os.rename(os.path.join(self.root, "ecmascript_simd-%s" % revision),
97 directory_name) 131 directory_name)
98 132
133 with open(versionfile, "w") as f:
134 f.write(SIMDJS_ARCHIVE_MD5 + '\n')
Michael Achenbach 2015/07/23 21:05:13 Maybe the line splitting doesn't work as expected?
135 f.write(archive_url + '\n')
136 f.write(revision + '\n')
137
99 138
100 def GetSuite(name, root): 139 def GetSuite(name, root):
101 return SimdJsTestSuite(name, root) 140 return SimdJsTestSuite(name, root)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698