Index: build/android/test_runner.py |
diff --git a/build/android/test_runner.py b/build/android/test_runner.py |
index f89fdb9263bc9008ac61a6e3325e765b8c90bfe5..aba1918907aa9ad74431cca4b176f43ed4b0a272 100755 |
--- a/build/android/test_runner.py |
+++ b/build/android/test_runner.py |
@@ -281,6 +281,12 @@ 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', action='store_true', default=False, |
+ help=('Run instrumentation tests with the EMMA ' |
+ 'coverage tool.')) |
+ option_parser.add_option('--coverage_dir', default=None, |
+ help=('Directory in which to place all generated ' |
+ 'EMMA coverage files.')) |
frankf
2013/07/25 18:53:44
Just use coverage_dir to enable coverage
gkanwar1
2013/07/25 19:06:38
Good point. Updated.
|
def ProcessInstrumentationOptions(options, error_func): |
@@ -305,6 +311,9 @@ def ProcessInstrumentationOptions(options, error_func): |
_SDK_OUT_DIR, options.build_type, constants.SDK_BUILD_TEST_JAVALIB_DIR, |
'%s.jar' % options.test_apk) |
+ if options.coverage and not options.coverage_dir: |
+ error_func('--coverage_dir must be specified if running with coverage.') |
+ |
def AddUIAutomatorTestOptions(option_parser): |
"""Adds UI Automator test options to |option_parser|.""" |
@@ -431,7 +440,7 @@ def _RunInstrumentationTests(options, error_func): |
options.test_data, options.install_apk, options.save_perf_json, |
options.screenshot_failures, options.tool, options.wait_for_debugger, |
options.disable_assertions, options.push_deps, |
- options.cleanup_test_files) |
+ options.cleanup_test_files, options.coverage, options.coverage_dir) |
test_results, exit_code = test_dispatcher.RunTests( |
tests, runner_factory, options.wait_for_debugger, |