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

Unified Diff: build/util/lib/common/unittest_util.py

Issue 1522303002: Enforce ordering in FilterTestNames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..5f5b158119dcda5f0f7946e2c05cd28e1a273d5b 100644
--- a/build/util/lib/common/unittest_util.py
+++ b/build/util/lib/common/unittest_util.py
@@ -132,22 +132,15 @@ 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]
+ for i in range(len(positive_patterns)):
+ pt_tests = [test for test in all_tests
mikecase (-- gone --) 2015/12/15 16:32:20 What does "pt" stand for?
+ if (fnmatch.fnmatch(test, positive_patterns[i]) and
+ not any(fnmatch(test, p) for p in negative_patterns) and
+ not any(fnmatch(test, p) for p in positive_patterns[:i]))]
jbudorick 2015/12/15 16:35:58 I think you could make tests a set instead of a li
+ tests.extend(pt_tests)
return tests
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698