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

Unified Diff: tools/isolate/run_test_cases.py

Issue 10829014: Add --gtest_filter support to run_test_cases.py. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months 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 | tools/isolate/run_test_cases_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/isolate/run_test_cases.py
diff --git a/tools/isolate/run_test_cases.py b/tools/isolate/run_test_cases.py
index 77344a949d51719a3163d3e1332f9cfb14c7bf58..a8367c40a204b046b063963581454d6db59e8a19 100755
--- a/tools/isolate/run_test_cases.py
+++ b/tools/isolate/run_test_cases.py
@@ -557,7 +557,7 @@ def run_test_cases(executable, test_cases, jobs, timeout, no_dump):
return int(bool(fail))
-def main():
+def main(argv):
"""CLI frontend to validate arguments."""
def as_digit(variable, default):
if variable.isdigit():
@@ -611,8 +611,12 @@ def main():
group.add_option(
'-T', '--test-case-file',
help='File containing the exact list of test cases to run')
+ group.add_option(
+ '--gtest_filter',
+ help='Runs a single test, provideded to keep compatibility with '
+ 'other tools')
parser.add_option_group(group)
- options, args = parser.parse_args()
+ options, args = parser.parse_args(argv)
levels = [logging.ERROR, logging.INFO, logging.DEBUG]
logging.basicConfig(
@@ -634,6 +638,18 @@ def main():
if not os.path.isfile(executable):
parser.error('"%s" doesn\'t exist.' % executable)
+ if options.gtest_filter:
+ # Override any other option.
+ # Based on UnitTestOptions::FilterMatchesTest() in
+ # http://code.google.com/p/googletest/source/browse/#svn%2Ftrunk%2Fsrc
+ if '-' in options.gtest_filter:
+ options.whitelist, options.blacklist = options.gtest_filter.split('-', 1)
+ else:
+ options.whitelist = options.gtest_filter
+ options.blacklist = ''
+ options.whitelist = [i for i in options.whitelist.split(':') if i]
+ options.blacklist = [i for i in options.blacklist.split(':') if i]
+
# Grab the test cases.
if options.test_case_file:
with open(options.test_case_file, 'r') as f:
@@ -647,7 +663,7 @@ def main():
options.shards)
if not test_cases:
- return
+ return 0
return run_test_cases(
executable,
@@ -658,4 +674,4 @@ def main():
if __name__ == '__main__':
- sys.exit(main())
+ sys.exit(main(sys.argv[1:]))
« no previous file with comments | « no previous file | tools/isolate/run_test_cases_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698