Index: test/test262/testcfg.py |
diff --git a/test/test262/testcfg.py b/test/test262/testcfg.py |
index aefda196a307db7677702cab6075c99d0cf65a3f..294b39c9163feac30f941e148ac415ce5f8b47ed 100644 |
--- a/test/test262/testcfg.py |
+++ b/test/test262/testcfg.py |
@@ -29,8 +29,14 @@ |
import test |
import os |
from os.path import join, exists |
+import urllib |
+import hashlib |
+import tarfile |
+TEST_262_ARCHIVE_REVISION = '3a890174343c' # This is the r309 revision. |
+TEST_262_ARCHIVE_MD5 = 'be5d4cfbe69cef70430907b8f3a92b50' |
+TEST_262_URL = 'http://hg.ecmascript.org/tests/test262/archive/%s.tar.bz2' |
TEST_262_HARNESS = ['sta.js'] |
@@ -93,6 +99,28 @@ class Test262TestConfiguration(test.TestConfiguration): |
tests.append(test) |
return tests |
+ def DownloadData(self): |
+ revision = TEST_262_ARCHIVE_REVISION |
+ archive_url = TEST_262_URL % revision |
+ archive_name = join(self.root, 'test262-%s.tar.bz2' % revision) |
+ directory_name = join(self.root, "test262-%s" % revision) |
+ if not exists(directory_name) or not exists(archive_name): |
+ if not exists(archive_name): |
+ print "Downloading test data from %s ..." % archive_url |
+ urllib.urlretrieve(archive_url, archive_name) |
+ if not exists(directory_name): |
+ print "Extracting test262-%s.tar.bz2 ..." % revision |
+ md5 = hashlib.md5() |
+ with open(archive_name,'rb') as f: |
+ for chunk in iter(lambda: f.read(8192), ''): |
+ md5.update(chunk) |
+ if md5.hexdigest() != TEST_262_ARCHIVE_MD5: |
+ raise Exception("Hash mismatch of test data file") |
+ archive = tarfile.open(archive_name, 'r:bz2') |
+ archive.extractall(join(self.root)) |
+ if not exists(join(self.root, 'data')): |
+ os.symlink(directory_name, join(self.root, 'data')) |
+ |
def GetBuildRequirements(self): |
return ['d8'] |