Commit 3bc1b134 authored by machenbach's avatar machenbach Committed by Commit bot

[test] Let test runner only use exact matches of tests on the cmd-line.

There are many test names in the v8 code base that prefix
others, which makes it hard to only run those tests.

BUG=chromium:511215
LOG=n
NOTRY=true

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

Cr-Commit-Position: refs/heads/master@{#29809}
parent 7bedb50f
...@@ -175,8 +175,15 @@ class TestSuite(object): ...@@ -175,8 +175,15 @@ class TestSuite(object):
print("Unused rule: %s -> %s" % (rule, self.wildcards[rule])) print("Unused rule: %s -> %s" % (rule, self.wildcards[rule]))
def FilterTestCasesByArgs(self, args): def FilterTestCasesByArgs(self, args):
"""Filter test cases based on command-line arguments.
An argument with an asterisk in the end will match all test cases
that have the argument as a prefix. Without asterisk, only exact matches
will be used with the exeption of the test-suite name as argument.
"""
filtered = [] filtered = []
filtered_args = [] globs = []
exact_matches = []
for a in args: for a in args:
argpath = a.split(os.path.sep) argpath = a.split(os.path.sep)
if argpath[0] != self.name: if argpath[0] != self.name:
...@@ -186,12 +193,18 @@ class TestSuite(object): ...@@ -186,12 +193,18 @@ class TestSuite(object):
path = os.path.sep.join(argpath[1:]) path = os.path.sep.join(argpath[1:])
if path[-1] == '*': if path[-1] == '*':
path = path[:-1] path = path[:-1]
filtered_args.append(path) globs.append(path)
else:
exact_matches.append(path)
for t in self.tests: for t in self.tests:
for a in filtered_args: for a in globs:
if t.path.startswith(a): if t.path.startswith(a):
filtered.append(t) filtered.append(t)
break break
for a in exact_matches:
if t.path == a:
filtered.append(t)
break
self.tests = filtered self.tests = filtered
def GetFlagsForTestCase(self, testcase, context): def GetFlagsForTestCase(self, testcase, context):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment