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

Unified Diff: test/test262/testcfg.py

Issue 2611793002: [test] Process to locally develop and upstream test262 tests (Closed)
Patch Set: Cleanup nit Created 3 years, 11 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
« no previous file with comments | « test/test262/test262.status ('k') | test/test262/upstream-local-tests.sh » ('j') | 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 d8123968fca0578e35855b0192e580944322656f..1b0162c84975ebd90be9eeccb201e30a39c19d18 100644
--- a/test/test262/testcfg.py
+++ b/test/test262/testcfg.py
@@ -27,6 +27,7 @@
import imp
+import itertools
import os
import re
import sys
@@ -47,6 +48,10 @@ TEST_262_NATIVE_FILES = ["detachArrayBuffer.js"]
TEST_262_SUITE_PATH = ["data", "test"]
TEST_262_HARNESS_PATH = ["data", "harness"]
TEST_262_TOOLS_PATH = ["harness", "src"]
+TEST_262_LOCAL_TESTS_PATH = ["local-tests", "test"]
+
+TEST_262_RELPATH_REGEXP = re.compile(
+ r'.*[\\/]test[\\/]test262[\\/][^\\/]+[\\/]test[\\/](.*)\.js')
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)),
*TEST_262_TOOLS_PATH))
@@ -101,6 +106,8 @@ class Test262VariantGenerator(testsuite.VariantGenerator):
class Test262TestSuite(testsuite.TestSuite):
+ # Match the (...) in '/path/to/v8/test/test262/subdir/test/(...).js'
+ # In practice, subdir is data or local-tests
def __init__(self, name, root):
super(Test262TestSuite, self).__init__(name, root)
@@ -109,11 +116,14 @@ class Test262TestSuite(testsuite.TestSuite):
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.localtestroot = os.path.join(self.root, *TEST_262_LOCAL_TESTS_PATH)
self.ParseTestRecord = None
def ListTests(self, context):
tests = []
- for dirname, dirs, files in os.walk(self.testroot):
+ testnames = set()
+ for dirname, dirs, files in itertools.chain(os.walk(self.testroot),
+ os.walk(self.localtestroot)):
for dotted in [x for x in dirs if x.startswith(".")]:
dirs.remove(dotted)
if context.noi18n and "intl402" in dirs:
@@ -121,19 +131,20 @@ class Test262TestSuite(testsuite.TestSuite):
dirs.sort()
files.sort()
for filename in files:
- if filename.endswith(".js") and not filename.endswith("_FIXTURE.js"):
- fullpath = os.path.join(dirname, filename)
- relpath = fullpath[len(self.testroot) + 1 : -3]
- testname = relpath.replace(os.path.sep, "/")
- case = testcase.TestCase(self, testname)
- tests.append(case)
- return tests
+ if not filename.endswith(".js"):
+ continue
+ if filename.endswith("_FIXTURE.js"):
+ continue
+ fullpath = os.path.join(dirname, filename)
+ relpath = re.match(TEST_262_RELPATH_REGEXP, fullpath).group(1)
+ testnames.add(relpath.replace(os.path.sep, "/"))
+ return [testcase.TestCase(self, testname) for testname in testnames]
def GetFlagsForTestCase(self, testcase, context):
return (testcase.flags + context.mode_flags + self.harness +
self.GetIncludesForTest(testcase) + ["--harmony"] +
(["--module"] if "module" in self.GetTestRecord(testcase) else []) +
- [os.path.join(self.testroot, testcase.path + ".js")] +
+ [self.GetPathForTest(testcase)] +
(["--throws"] if "negative" in self.GetTestRecord(testcase)
else []) +
(["--allow-natives-syntax"]
@@ -179,9 +190,14 @@ class Test262TestSuite(testsuite.TestSuite):
includes = []
return includes
+ def GetPathForTest(self, testcase):
+ filename = os.path.join(self.localtestroot, testcase.path + ".js")
+ if not os.path.exists(filename):
+ filename = os.path.join(self.testroot, testcase.path + ".js")
+ return filename
+
def GetSourceForTest(self, testcase):
- filename = os.path.join(self.testroot, testcase.path + ".js")
- with open(filename) as f:
+ with open(self.GetPathForTest(testcase)) as f:
return f.read()
def _ParseException(self, str):
« no previous file with comments | « test/test262/test262.status ('k') | test/test262/upstream-local-tests.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698