Index: test/simdjs/testcfg.py |
diff --git a/test/simdjs/testcfg.py b/test/simdjs/testcfg.py |
index c0390afd65ea2f38da8f4bc1191863bcd38bd91e..66f0cce0811537a37165b858732bbfe212564a64 100644 |
--- a/test/simdjs/testcfg.py |
+++ b/test/simdjs/testcfg.py |
@@ -65,10 +65,44 @@ class SimdJsTestSuite(testsuite.TestSuite): |
def DownloadData(self): |
revision = SIMDJS_ARCHIVE_REVISION |
archive_url = SIMDJS_URL % revision |
+ |
+ archive_prefix = "ecmascript_simd-" |
archive_name = os.path.join( |
- self.root, "ecmascript_simd-%s.tar.gz" % revision) |
+ self.root, "%s%s.tar.gz" % (archive_prefix, revision)) |
directory_name = os.path.join(self.root, "data") |
directory_old_name = os.path.join(self.root, "data.old") |
+ 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
|
+ |
+ checked_out_version = None |
+ checked_out_url = None |
+ checked_out_revision = None |
+ if os.path.exists(versionfile): |
+ with open(versionfile) as f: |
+ try: |
+ (checked_out_version, |
+ checked_out_url, |
+ checked_out_revision) = f.read().splitlines() |
+ except ValueError: |
+ pass |
+ if (checked_out_version != SIMDJS_ARCHIVE_MD5 or |
+ checked_out_url != archive_url or |
+ checked_out_revision != revision): |
+ if os.path.exists(archive_name): |
+ print "Clobbering %s because CHECK_OUT_VERSION is out of date" % ( |
+ archive_name) |
+ os.remove(archive_name) |
+ |
+ # Clobber if the test is in an outdated state, i.e. if there are any other |
+ # archive files present. |
+ archive_files = [f for f in os.listdir(self.root) |
+ if f.startswith(archive_prefix)] |
+ if (len(archive_files) > 1 or |
+ os.path.basename(archive_name) not in archive_files): |
+ print "Clobber outdated test archives ..." |
+ for f in archive_files: |
+ print "Removing %s" % f |
+ os.remove(os.path.join(self.root, f)) |
+ |
if not os.path.exists(archive_name): |
print "Downloading test data from %s ..." % archive_url |
utils.URLRetrieve(archive_url, archive_name) |
@@ -96,6 +130,11 @@ class SimdJsTestSuite(testsuite.TestSuite): |
os.rename(os.path.join(self.root, "ecmascript_simd-%s" % revision), |
directory_name) |
+ with open(versionfile, "w") as f: |
+ f.write(SIMDJS_ARCHIVE_MD5 + '\n') |
Michael Achenbach
2015/07/23 21:05:13
Maybe the line splitting doesn't work as expected?
|
+ f.write(archive_url + '\n') |
+ f.write(revision + '\n') |
+ |
def GetSuite(name, root): |
return SimdJsTestSuite(name, root) |