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

Unified Diff: tools/isolate/run_test_cases.py

Issue 10993035: Reduce code duplication between run_test_cases.py and trace_test_cases.py. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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/trace_test_cases.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 4836699453def61d8efee7eef6c0b3b6a1a92f7a..f12d5798579ed77f7ae592cf4566ee5b99812fd7 100755
--- a/tools/isolate/run_test_cases.py
+++ b/tools/isolate/run_test_cases.py
@@ -812,23 +812,42 @@ class OptionParserWithTestShardingAndFiltering(OptionParserWithTestSharding):
return options, args
+ @staticmethod
+ def process_gtest_options(executable, options):
+ """Grabs the test cases."""
+ if options.test_case_file:
+ with open(options.test_case_file, 'r') as f:
+ return sorted(filter(None, f.read().splitlines()))
+ else:
+ return get_test_cases(
+ executable,
+ options.whitelist,
+ options.blacklist,
+ options.index,
+ options.shards)
+
+
+class OptionParserTestCases(OptionParserWithTestShardingAndFiltering):
+ def __init__(self, *args, **kwargs):
+ OptionParserWithTestShardingAndFiltering.__init__(self, *args, **kwargs)
+ self.add_option(
+ '-j', '--jobs',
+ type='int',
+ default=num_processors(),
+ help='number of parallel jobs; default=%default')
+ self.add_option(
+ '-t', '--timeout',
+ type='int',
+ default=120,
+ help='Timeout for a single test case, in seconds default:%default')
+
def main(argv):
"""CLI frontend to validate arguments."""
- parser = OptionParserWithTestShardingAndFiltering(
+ parser = OptionParserTestCases(
usage='%prog <options> [gtest]',
verbose=int(os.environ.get('ISOLATE_DEBUG', 0)))
parser.add_option(
- '-j', '--jobs',
- type='int',
- default=num_processors(),
- help='number of parallel jobs; default=%default')
- parser.add_option(
- '-t', '--timeout',
- type='int',
- default=120,
- help='Timeout for a single test case, in seconds default:%default')
- parser.add_option(
'--run-all',
action='store_true',
default=bool(int(os.environ.get('RUN_TEST_CASES_RUN_ALL', '0'))),
@@ -858,18 +877,7 @@ def main(argv):
if not os.path.isfile(executable):
parser.error('"%s" doesn\'t exist.' % executable)
- # Grab the test cases.
- if options.test_case_file:
- with open(options.test_case_file, 'r') as f:
- test_cases = filter(None, f.read().splitlines())
- else:
- test_cases = get_test_cases(
- executable,
- options.whitelist,
- options.blacklist,
- options.index,
- options.shards)
-
+ test_cases = parser.process_gtest_options(executable, options)
if not test_cases:
# If test_cases is None then there was a problem generating the tests to
# run, so this should be considered a failure.
« no previous file with comments | « no previous file | tools/isolate/trace_test_cases.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698