summaryrefslogtreecommitdiffstats
path: root/build/util
diff options
context:
space:
mode:
authoralexandermont <alexandermont@chromium.org>2015-12-15 15:13:38 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-15 23:14:42 +0000
commitdaeb80935df8b1532de2cf12879ea3d40a0615ae (patch)
treeb4c9111fdb3627954419aabb548ed71621cbb180 /build/util
parent4d1e70c750dc009ce1c23e76b8c2009264dba0ef (diff)
downloadchromium_src-daeb80935df8b1532de2cf12879ea3d40a0615ae.zip
chromium_src-daeb80935df8b1532de2cf12879ea3d40a0615ae.tar.gz
chromium_src-daeb80935df8b1532de2cf12879ea3d40a0615ae.tar.bz2
Enforce ordering in FilterTestNames.
BUG=569723 Review URL: https://codereview.chromium.org/1522303002 Cr-Commit-Position: refs/heads/master@{#365376}
Diffstat (limited to 'build/util')
-rw-r--r--build/util/lib/common/unittest_util.py24
1 files changed, 10 insertions, 14 deletions
diff --git a/build/util/lib/common/unittest_util.py b/build/util/lib/common/unittest_util.py
index 189f587..e2ad0e2 100644
--- a/build/util/lib/common/unittest_util.py
+++ b/build/util/lib/common/unittest_util.py
@@ -132,22 +132,18 @@ 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:
+ pattern_tests = [
+ test for test in all_tests
+ if (fnmatch.fnmatch(test, pattern)
+ and not any(fnmatch(test, p) for p in negative_patterns)
+ and test not in test_set)]
+ tests.extend(pattern_tests)
+ test_set.update(pattern_tests)
return tests