Chromium Code Reviews| Index: build/util/lib/common/unittest_util.py |
| diff --git a/build/util/lib/common/unittest_util.py b/build/util/lib/common/unittest_util.py |
| index 189f5871c740f046093bf36f69639407214bba78..e01227ade557b539bdda8eeec2aca6a75baa863a 100644 |
| --- a/build/util/lib/common/unittest_util.py |
| +++ b/build/util/lib/common/unittest_util.py |
| @@ -132,22 +132,17 @@ def FilterTestNames(all_tests, gtest_filter): |
| positive_patterns = ['*'] |
| if pattern_groups[0]: |
| positive_patterns = pattern_groups[0].split(':') |
| - negative_patterns = None |
| + negative_patterns = [] |
| if len(pattern_groups) > 1: |
| negative_patterns = pattern_groups[1].split(':') |
| tests = [] |
| - for test in all_tests: |
| - # Test name must by matched by one positive pattern. |
| - for pattern in positive_patterns: |
| - if fnmatch.fnmatch(test, pattern): |
| - break |
| - else: |
| - continue |
| - # Test name must not be matched by any negative patterns. |
| - for pattern in negative_patterns or []: |
| - if fnmatch.fnmatch(test, pattern): |
| - break |
| - else: |
| - tests += [test] |
| + test_set = set() |
| + for pattern in positive_patterns: |
| + ptrn_tests = [test for test in all_tests |
|
mikecase (-- gone --)
2015/12/15 19:20:28
nit: Would prefer if this was named pattern_tests
alexandermont
2015/12/15 19:37:53
if you do this, it makes line 144 too long
jbudorick
2015/12/15 19:38:54
I'd also prefer pattern_tests. You may need to han
|
| + if (fnmatch.fnmatch(test, pattern) and |
| + not any(fnmatch(test, p) for p in negative_patterns) and |
| + test not in test_set)] |
| + tests.extend(ptrn_tests) |
| + test_set.update(ptrn_tests) |
| return tests |