[test] Fix cctest path separators on Windows

Now run-tests.py understands "suite/foo/bar" with forward slashes for
command-line test selection on all test suites on all platforms.

Previously, file-based suites like mjsunit also accepted "mjsunit/foo\bar";
that behavior is sacrificed here in favor of unification. For the cctest
suite, OTOH, it wasn't possible on Windows to select specific tests at all.

Review URL: https://codereview.chromium.org/1348653003

Cr-Commit-Position: refs/heads/master@{#30794}
This commit is contained in:
jkummerow 2015-09-17 04:23:56 -07:00 committed by Commit bot
parent a535ed4bce
commit b36cfdb39a
8 changed files with 22 additions and 11 deletions

View File

@ -46,7 +46,9 @@ class IntlTestSuite(testsuite.TestSuite):
for filename in files:
if (filename.endswith(".js") and filename != "assert.js" and
filename != "utils.js"):
testname = os.path.join(dirname[len(self.root) + 1:], filename[:-3])
fullpath = os.path.join(dirname, filename)
relpath = fullpath[len(self.root) + 1 : -3]
testname = relpath.replace(os.path.sep, "/")
test = testcase.TestCase(self, testname)
tests.append(test)
return tests

View File

@ -52,7 +52,9 @@ class MessageTestSuite(testsuite.TestSuite):
files.sort()
for filename in files:
if filename.endswith(".js"):
testname = os.path.join(dirname[len(self.root) + 1:], filename[:-3])
fullpath = os.path.join(dirname, filename)
relpath = fullpath[len(self.root) + 1 : -3]
testname = relpath.replace(os.path.sep, "/")
test = testcase.TestCase(self, testname)
tests.append(test)
return tests

View File

@ -52,7 +52,9 @@ class MjsunitTestSuite(testsuite.TestSuite):
files.sort()
for filename in files:
if filename.endswith(".js") and filename != "mjsunit.js":
testname = os.path.join(dirname[len(self.root) + 1:], filename[:-3])
fullpath = os.path.join(dirname, filename)
relpath = fullpath[len(self.root) + 1 : -3]
testname = relpath.replace(os.path.sep, "/")
test = testcase.TestCase(self, testname)
tests.append(test)
return tests

View File

@ -81,8 +81,9 @@ class MozillaTestSuite(testsuite.TestSuite):
files.sort()
for filename in files:
if filename.endswith(".js") and not filename in FRAMEWORK:
testname = os.path.join(dirname[len(self.testroot) + 1:],
filename[:-3])
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

View File

@ -119,8 +119,9 @@ class Test262TestSuite(testsuite.TestSuite):
files.sort()
for filename in files:
if filename.endswith(".js"):
testname = os.path.join(dirname[len(self.testroot) + 1:],
filename[:-3])
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

View File

@ -66,8 +66,9 @@ class Test262TestSuite(testsuite.TestSuite):
files.sort()
for filename in files:
if filename.endswith(".js"):
testname = os.path.join(dirname[len(self.testroot) + 1:],
filename[:-3])
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

View File

@ -55,7 +55,9 @@ class WebkitTestSuite(testsuite.TestSuite):
files.sort()
for filename in files:
if filename.endswith(".js"):
testname = os.path.join(dirname[len(self.root) + 1:], filename[:-3])
fullpath = os.path.join(dirname, filename)
relpath = fullpath[len(self.root) + 1 : -3]
testname = relpath.replace(os.path.sep, "/")
test = testcase.TestCase(self, testname)
tests.append(test)
return tests

View File

@ -226,7 +226,7 @@ class TestSuite(object):
continue
if len(argpath) == 1 or (len(argpath) == 2 and argpath[1] == '*'):
return # Don't filter, run all tests in this suite.
path = os.path.sep.join(argpath[1:])
path = '/'.join(argpath[1:])
if path[-1] == '*':
path = path[:-1]
globs.append(path)