Chromium Code Reviews| Index: test/test262/testcfg.py |
| diff --git a/test/test262/testcfg.py b/test/test262/testcfg.py |
| index de3c9ad7b9f3645b7081806e137f133884ef3c31..76aefd65d725192d8265ed8020e033440702e5ec 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_PYTHON_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,48 @@ 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_PYTHON_PATH) |
| + f = None |
| + try: |
| + (f, pathname, description) = imp.find_module("parseTestRecord", [root]) |
| + module = imp.load_module("parseTestRecord", f, pathname, description) |
| + self.ParseTestRecord = module.parseTestRecord |
| + finally: |
| + if f: |
| + f.close() |
| + if not self.ParseTestRecord: |
| + raise Error("Cannot load parseTestRecord; you may need to --download-data for test262") |
|
Jakob Kummerow
2014/08/19 11:32:55
The only way this can happen is when there was an
smikes
2014/08/19 15:22:54
Done.
|
| + return self.ParseTestRecord |
| + |
| + def GetTestRecord(self, testcase): |
| + ParseTestRecord = self.LoadParseTestRecord() |
|
Jakob Kummerow
2014/08/19 11:32:55
Let's move this into the if-block where it's neede
smikes
2014/08/19 15:22:54
Done.
|
| + if not hasattr(testcase, "test_record"): |
| + 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"]] |
|
Jakob Kummerow
2014/08/19 11:32:55
nit: please adjust indentation here
smikes
2014/08/19 15:22:54
Done.
|
| + 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: |