Index: test/test262/testcfg.py |
diff --git a/test/test262/testcfg.py b/test/test262/testcfg.py |
index de3c9ad7b9f3645b7081806e137f133884ef3c31..5231f385e8e4e5437f836cd3fabdb41d542f24d3 100644 |
--- a/test/test262/testcfg.py |
+++ b/test/test262/testcfg.py |
@@ -31,26 +31,31 @@ import os |
import shutil |
import sys |
import tarfile |
+import imp |
from testrunner.local import testsuite |
from testrunner.local import utils |
from testrunner.objects import testcase |
- |
-TEST_262_ARCHIVE_REVISION = "fbba29f" # This is the r365 revision. |
-TEST_262_ARCHIVE_MD5 = "e1ff0db438cc12de8fb6da80621b4ef6" |
+TEST_262_ARCHIVE_REVISION = "595a36b" # This is the 2014-Aug-10 revision. |
+TEST_262_ARCHIVE_MD5 = "89dfc8458f474cdb7e8e178f3215dd06" |
TEST_262_URL = "https://github.com/tc39/test262/tarball/%s" |
-TEST_262_HARNESS = ["sta.js", "testBuiltInObject.js", "testIntl.js"] |
+TEST_262_HARNESS_FILES = ["sta.js"] |
+TEST_262_SUITE_PATH = ["data", "test", "suite"] |
+TEST_262_HARNESS_PATH = ["data", "test", "harness"] |
+TEST_262_TOOLS_PATH = ["data", "tools", "packaging"] |
class Test262TestSuite(testsuite.TestSuite): |
def __init__(self, name, root): |
super(Test262TestSuite, self).__init__(name, root) |
- self.testroot = os.path.join(root, "data", "test", "suite") |
- self.harness = [os.path.join(self.root, "data", "test", "harness", f) |
- for f in TEST_262_HARNESS] |
+ self.testroot = os.path.join(self.root, *TEST_262_SUITE_PATH) |
+ self.harnesspath = os.path.join(self.root, *TEST_262_HARNESS_PATH) |
+ self.harness = [os.path.join(self.harnesspath, f) |
+ for f in TEST_262_HARNESS_FILES] |
self.harness += [os.path.join(self.root, "harness-adapt.js")] |
+ self.ParseTestRecord = None |
def CommonTestName(self, testcase): |
return testcase.path.split(os.path.sep)[-1] |
@@ -74,15 +79,49 @@ class Test262TestSuite(testsuite.TestSuite): |
def GetFlagsForTestCase(self, testcase, context): |
return (testcase.flags + context.mode_flags + self.harness + |
+ self.GetIncludesForTest(testcase) + |
[os.path.join(self.testroot, testcase.path + ".js")]) |
+ def LoadParseTestRecord(self): |
+ if not self.ParseTestRecord: |
+ root = os.path.join(self.root, *TEST_262_TOOLS_PATH) |
+ f = None |
+ try: |
+ (f, pathname, description) = imp.find_module("parseTestRecord", [root]) |
+ module = imp.load_module("parseTestRecord", f, pathname, description) |
+ self.ParseTestRecord = module.parseTestRecord |
+ except: |
+ raise ImportError("Cannot load parseTestRecord; you may need to " |
+ "--download-data for test262") |
+ finally: |
+ if f: |
+ f.close() |
+ return self.ParseTestRecord |
+ |
+ def GetTestRecord(self, testcase): |
+ if not hasattr(testcase, "test_record"): |
+ ParseTestRecord = self.LoadParseTestRecord() |
+ testcase.test_record = ParseTestRecord(self.GetSourceForTest(testcase), |
+ testcase.path) |
+ return testcase.test_record |
+ |
+ def GetIncludesForTest(self, testcase): |
+ test_record = self.GetTestRecord(testcase) |
+ if "includes" in test_record: |
+ includes = [os.path.join(self.harnesspath, f) |
+ for f in test_record["includes"]] |
+ else: |
+ includes = [] |
+ return includes |
+ |
def GetSourceForTest(self, testcase): |
filename = os.path.join(self.testroot, testcase.path + ".js") |
with open(filename) as f: |
return f.read() |
def IsNegativeTest(self, testcase): |
- return "@negative" in self.GetSourceForTest(testcase) |
+ test_record = self.GetTestRecord(testcase) |
+ return "negative" in test_record |
def IsFailureOutput(self, output, testpath): |
if output.exit_code != 0: |