| Index: build/android/buildbot/bb_device_steps.py
|
| diff --git a/build/android/buildbot/bb_device_steps.py b/build/android/buildbot/bb_device_steps.py
|
| index 8bc537f0b893476dea35311ff731c0322503c80c..4a9fd7d7db6ff3c43a34421b73a4641a850d28db 100755
|
| --- a/build/android/buildbot/bb_device_steps.py
|
| +++ b/build/android/buildbot/bb_device_steps.py
|
| @@ -26,6 +26,7 @@ import errors
|
|
|
| CHROME_SRC = constants.DIR_SOURCE_ROOT
|
| LOGCAT_DIR = os.path.join(CHROME_SRC, 'out', 'logcat')
|
| +COVERAGE_DIR = os.path.join(CHROME_SRC, 'out', 'coverage')
|
|
|
| # Describes an instrumation test suite:
|
| # test: Name of test we're running.
|
| @@ -37,26 +38,28 @@ LOGCAT_DIR = os.path.join(CHROME_SRC, 'out', 'logcat')
|
| # annotation: Annotation of the tests to include.
|
| # exclude_annotation: The annotation of the tests to exclude.
|
| I_TEST = collections.namedtuple('InstrumentationTest', [
|
| - 'name', 'apk', 'apk_package', 'test_apk', 'test_data', 'host_driven_root',
|
| - 'annotation', 'exclude_annotation', 'extra_flags'])
|
| + 'name', 'apk', 'apk_package', 'test_apk', 'test_data', 'coverage',
|
| + 'host_driven_root', 'annotation', 'exclude_annotation', 'extra_flags'])
|
|
|
| -def I(name, apk, apk_package, test_apk, test_data, host_driven_root=None,
|
| - annotation=None, exclude_annotation=None, extra_flags=None):
|
| - return I_TEST(name, apk, apk_package, test_apk, test_data, host_driven_root,
|
| - annotation, exclude_annotation, extra_flags)
|
| +def I(name, apk, apk_package, test_apk, test_data, coverage=False,
|
| + host_driven_root=None, annotation=None, exclude_annotation=None,
|
| + extra_flags=None):
|
| + return I_TEST(name, apk, apk_package, test_apk, test_data, coverage,
|
| + host_driven_root, annotation, exclude_annotation, extra_flags)
|
|
|
| INSTRUMENTATION_TESTS = dict((suite.name, suite) for suite in [
|
| I('ContentShell',
|
| 'ContentShell.apk',
|
| 'org.chromium.content_shell_apk',
|
| 'ContentShellTest',
|
| - 'content:content/test/data/android/device_files'),
|
| + 'content:content/test/data/android/device_files',
|
| + coverage=True),
|
| I('ChromiumTestShell',
|
| 'ChromiumTestShell.apk',
|
| 'org.chromium.chrome.testshell',
|
| 'ChromiumTestShellTest',
|
| 'chrome:chrome/test/data/android/device_files',
|
| - constants.CHROMIUM_TEST_SHELL_HOST_DRIVEN_DIR),
|
| + host_driven_root=constants.CHROMIUM_TEST_SHELL_HOST_DRIVEN_DIR),
|
| I('AndroidWebView',
|
| 'AndroidWebView.apk',
|
| 'org.chromium.android_webview.shell',
|
| @@ -164,6 +167,8 @@ def RunInstrumentationSuite(options, test, flunk_on_failure=True,
|
| if options.flakiness_server:
|
| args.append('--flakiness-dashboard-server=%s' %
|
| options.flakiness_server)
|
| + if options.coverage and test.coverage:
|
| + args.append('--coverage-dir=%s' % COVERAGE_DIR)
|
| if test.host_driven_root:
|
| args.append('--python_test_root=%s' % test.host_driven_root)
|
| if test.annotation:
|
| @@ -271,6 +276,12 @@ def RunInstrumentationTests(options):
|
| for test in INSTRUMENTATION_TESTS.itervalues():
|
| RunInstrumentationSuite(options, test)
|
|
|
| + if options.coverage:
|
| + RunCmd(['build/android/generate_emma_html.py',
|
| + '--coverage-dir', COVERAGE_DIR,
|
| + '--metadata-dir', os.path.join('out', options.target),
|
| + '--output', os.path.join(COVERAGE_DIR, 'coverage.html')])
|
| +
|
|
|
| def RunWebkitTests(options):
|
| RunTestSuites(options, ['webkit_unit_tests'])
|
| @@ -347,6 +358,8 @@ def GetDeviceStepsOptParser():
|
| help='Install an apk by name')
|
| parser.add_option('--reboot', action='store_true',
|
| help='Reboot devices before running tests')
|
| + parser.add_option('--coverage', action='store_true',
|
| + help='Run instrumentation tests with coverage.')
|
| parser.add_option(
|
| '--flakiness-server',
|
| help='The flakiness dashboard server to which the results should be '
|
|
|