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

Unified Diff: test/test262/testcfg.py

Issue 478163002: test/test262: update testcfg.py for new test262 (Closed) Base URL: git@github.com:smikes/v8.git@master
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« test/test262/harness-adapt.js ('K') | « test/test262/harness-adapt.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/test262/testcfg.py
diff --git a/test/test262/testcfg.py b/test/test262/testcfg.py
index de3c9ad7b9f3645b7081806e137f133884ef3c31..9ee4933c6b29792164360fe294b4b2ee99fde905 100644
--- a/test/test262/testcfg.py
+++ b/test/test262/testcfg.py
@@ -36,21 +36,36 @@ 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 = ["sta.js"]
+
+TEST_262_ROOT = ["data", "test"]
+TEST_262_SUITE_ROOT = TEST_262_ROOT + ["suite"]
+TEST_262_HARNESS_ROOT = TEST_262_ROOT + ["harness"]
+TEST_262_PYTHON_ROOT = ["data", "tools", "packaging"]
+# import parseTestRecord
Jakob Kummerow 2014/08/18 11:55:47 Nit: comments should have proper capitalization an
smikes 2014/08/18 16:04:26 Removed needless comment.
+sys.path.append(os.path.abspath(os.path.join('test', 'test262', *TEST_262_PYTHON_ROOT)))
Jakob Kummerow 2014/08/18 11:55:47 nit: 80col please. Also, if we need to muck with
smikes 2014/08/18 16:04:27 Fixed both. Is there a more idiomatic way of impo
Jakob Kummerow 2014/08/18 16:14:10 There is imp, https://docs.python.org/2/library/im
+try:
+ from parseTestRecord import parseTestRecord
Jakob Kummerow 2014/08/18 11:55:47 nit: "... as ParseTestRecord" to adhere to Capital
smikes 2014/08/18 16:04:26 Done.
+except ImportError:
+ print "Need to --download-data for test262"
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.harness += [os.path.join(self.root, "harness-adapt.js")]
+ # set up paths
+ self.testroot = os.path.join(self.root, *TEST_262_SUITE_ROOT)
+ self.harnesspath = os.path.join(self.root, *TEST_262_HARNESS_ROOT)
+
+ # basic test harness consists of TEST_262_HARNESS files
+ # and our harness adapter
+ self.harness = [os.path.join(self.harnesspath, f)
+ for f in TEST_262_HARNESS] + [
Jakob Kummerow 2014/08/18 11:55:47 Please move the last '[' to the next line for bett
smikes 2014/08/18 16:04:26 Done.
+ os.path.join(self.root, "harness-adapt.js")]
def CommonTestName(self, testcase):
return testcase.path.split(os.path.sep)[-1]
@@ -74,15 +89,32 @@ 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 GetIncludesForTest(self, testcase):
+ try:
Jakob Kummerow 2014/08/18 11:55:47 The V8 project as a whole is not too fond of excep
smikes 2014/08/18 16:04:27 Done.
+ testRecord = parseTestRecord(self.GetSourceForTest(testcase), testcase.path)
Jakob Kummerow 2014/08/18 11:55:47 nit: 80col
+ return [os.path.join(self.harnesspath, f)
+ for f in testRecord['includes']]
+ except KeyError:
+ return []
+
def GetSourceForTest(self, testcase):
- filename = os.path.join(self.testroot, testcase.path + ".js")
- with open(filename) as f:
- return f.read()
+ try:
+ return testcase.source
Jakob Kummerow 2014/08/18 11:55:47 No need to cache this; the framework is careful no
smikes 2014/08/18 16:04:26 Yes, but I was calling GetSourceForTest repeatedly
+ except AttributeError:
+ filename = os.path.join(self.testroot, testcase.path + ".js")
+ with open(filename) as f:
+ testcase.source = f.read()
+ return testcase.source
def IsNegativeTest(self, testcase):
- return "@negative" in self.GetSourceForTest(testcase)
+ testRecord = parseTestRecord(self.GetSourceForTest(testcase), testcase.path)
Jakob Kummerow 2014/08/18 11:55:47 nit: s/testRecord/test_record/
smikes 2014/08/18 16:04:27 Done.
+ try:
Jakob Kummerow 2014/08/18 11:55:47 Again, I'd prefer 'if "negative" in test_record:'
smikes 2014/08/18 16:04:27 Done.
+ return testRecord['negative']
+ except KeyError:
+ return False
def IsFailureOutput(self, output, testpath):
if output.exit_code != 0:
« test/test262/harness-adapt.js ('K') | « test/test262/harness-adapt.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698