diff options
author | jbudorick <jbudorick@chromium.org> | 2015-01-13 15:49:28 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-13 23:50:14 +0000 |
commit | e6c56015219f5824bf0cad7f69d888f14e693e3e (patch) | |
tree | fbb44cb6dd5ba84044b3a2763e9a618151c29493 /build/android/pylib/remote/device/remote_device_gtest_run.py | |
parent | 05b83de45a179f95fca6c4c1bf08142f93268451 (diff) | |
download | chromium_src-e6c56015219f5824bf0cad7f69d888f14e693e3e.zip chromium_src-e6c56015219f5824bf0cad7f69d888f14e693e3e.tar.gz chromium_src-e6c56015219f5824bf0cad7f69d888f14e693e3e.tar.bz2 |
[Android] Add file-based gtest filtering for gtests on AMP.
BUG=428729
Review URL: https://codereview.chromium.org/810193007
Cr-Commit-Position: refs/heads/master@{#311363}
Diffstat (limited to 'build/android/pylib/remote/device/remote_device_gtest_run.py')
-rw-r--r-- | build/android/pylib/remote/device/remote_device_gtest_run.py | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/build/android/pylib/remote/device/remote_device_gtest_run.py b/build/android/pylib/remote/device/remote_device_gtest_run.py index 3a6c447..e5f6990 100644 --- a/build/android/pylib/remote/device/remote_device_gtest_run.py +++ b/build/android/pylib/remote/device/remote_device_gtest_run.py @@ -7,6 +7,7 @@ import logging import os import sys +import tempfile from pylib import constants from pylib.base import base_test_result @@ -15,6 +16,14 @@ from pylib.remote.device import remote_device_test_run from pylib.remote.device import remote_device_helper +_EXTRA_COMMAND_LINE_FILE = ( + 'org.chromium.native_test.ChromeNativeTestActivity.CommandLineFile') +# TODO(jbudorick): Remove this extra when b/18981674 is fixed. +_EXTRA_ONLY_OUTPUT_FAILURES = ( + 'org.chromium.native_test.ChromeNativeTestInstrumentationTestRunner.' + 'OnlyOutputFailures') + + class RemoteDeviceGtestRun(remote_device_test_run.RemoteDeviceTestRun): """Run gtests and uirobot tests on a remote device.""" @@ -43,8 +52,20 @@ class RemoteDeviceGtestRun(remote_device_test_run.RemoteDeviceTestRun): dummy_app_path = os.path.join( constants.GetOutDirectory(), 'apks', 'remote_device_dummy.apk') - self._AmInstrumentTestSetup(dummy_app_path, self._test_instance.apk, - runner_package) + with tempfile.NamedTemporaryFile(suffix='.flags.txt') as flag_file: + env_vars = {} + filter_string = self._test_instance._GenerateDisabledFilterString(None) + if filter_string: + flag_file.write('_ --gtest_filter=%s' % filter_string) + flag_file.flush() + env_vars[_EXTRA_COMMAND_LINE_FILE] = os.path.basename(flag_file.name) + self._test_instance._data_deps.append( + (os.path.abspath(flag_file.name), None)) + if self._env.only_output_failures: + env_vars[_EXTRA_ONLY_OUTPUT_FAILURES] = None + self._AmInstrumentTestSetup( + dummy_app_path, self._test_instance.apk, runner_package, + environment_variables=env_vars) _INSTRUMENTATION_STREAM_LEADER = 'INSTRUMENTATION_STATUS: stream=' @@ -62,6 +83,8 @@ class RemoteDeviceGtestRun(remote_device_test_run.RemoteDeviceTestRun): if l.startswith(self._INSTRUMENTATION_STREAM_LEADER)) results_list = self._test_instance.ParseGTestOutput(output) results.AddResults(results_list) + if self._env.only_output_failures: + logging.info('See logcat for more results information.') if not self._results['results']['pass']: results.AddResult(base_test_result.BaseTestResult( 'Remote Service detected error.', |