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

Unified Diff: build/android/test_runner.py

Issue 23293006: [Android] Adds python option for EMMA coverage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removes GetCoverageDir Created 7 years, 4 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 | « build/android/pylib/utils/command_option_parser.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/test_runner.py
diff --git a/build/android/test_runner.py b/build/android/test_runner.py
index 26c4e291d44d396fd109570cdaa7cb60e5db27d3..8acce41e52afe1caf45c0bcb8a7c613acec3ca9d 100755
--- a/build/android/test_runner.py
+++ b/build/android/test_runner.py
@@ -33,6 +33,7 @@ from pylib.perf import test_options as perf_test_options
from pylib.perf import test_runner as perf_test_runner
from pylib.uiautomator import setup as uiautomator_setup
from pylib.uiautomator import test_options as uiautomator_test_options
+from pylib.utils import command_option_parser
from pylib.utils import report_results
from pylib.utils import run_tests_helper
@@ -228,6 +229,9 @@ def AddInstrumentationTestOptions(option_parser):
help=('The name of the apk containing the tests '
'(without the .apk extension; e.g. "ContentShellTest"). '
'Alternatively, this can be a full path to the apk.'))
+ option_parser.add_option('--coverage-dir',
+ help=('Directory in which to place all generated '
+ 'EMMA coverage files.'))
def ProcessInstrumentationOptions(options, error_func):
@@ -285,6 +289,7 @@ def ProcessInstrumentationOptions(options, error_func):
options.save_perf_json,
options.screenshot_failures,
options.wait_for_debugger,
+ options.coverage_dir,
options.test_apk,
options.test_apk_path,
options.test_apk_jar_path)
@@ -701,47 +706,10 @@ VALID_COMMANDS = {
}
-class CommandOptionParser(optparse.OptionParser):
- """Wrapper class for OptionParser to help with listing commands."""
-
- def __init__(self, *args, **kwargs):
- self.command_list = kwargs.pop('command_list', [])
- self.example = kwargs.pop('example', '')
- optparse.OptionParser.__init__(self, *args, **kwargs)
-
- #override
- def get_usage(self):
- normal_usage = optparse.OptionParser.get_usage(self)
- command_list = self.get_command_list()
- example = self.get_example()
- return self.expand_prog_name(normal_usage + example + command_list)
-
- #override
- def get_command_list(self):
- if self.command_list:
- return '\nCommands:\n %s\n' % '\n '.join(sorted(self.command_list))
- return ''
-
- def get_example(self):
- if self.example:
- return '\nExample:\n %s\n' % self.example
- return ''
-
-
def main(argv):
- option_parser = CommandOptionParser(
- usage='Usage: %prog <command> [options]',
- command_list=VALID_COMMANDS.keys())
-
- if len(argv) < 2 or argv[1] not in VALID_COMMANDS:
- # Parse args first, if this is '--help', optparse will display help and exit
- option_parser.parse_args(argv)
- option_parser.error('Invalid command.')
- command = argv[1]
- VALID_COMMANDS[command].add_options_func(option_parser)
- options, args = option_parser.parse_args(argv)
- return VALID_COMMANDS[command].run_command_func(
- command, options, args, option_parser)
+ option_parser = command_option_parser.CommandOptionParser(
+ commands_dict=VALID_COMMANDS)
+ return command_option_parser.ParseAndExecute(option_parser)
if __name__ == '__main__':
« no previous file with comments | « build/android/pylib/utils/command_option_parser.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698