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

Unified Diff: build/android/pylib/remote/device/remote_device_gtest_run.py

Issue 832493005: Add Instrumentation test support to remote device (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
Index: build/android/pylib/remote/device/remote_device_gtest_run.py
diff --git a/build/android/pylib/remote/device/remote_device_gtest_run.py b/build/android/pylib/remote/device/remote_device_gtest_run.py
deleted file mode 100644
index e5f6990c53e14f7ea04c6425013ce791c8dafec3..0000000000000000000000000000000000000000
--- a/build/android/pylib/remote/device/remote_device_gtest_run.py
+++ /dev/null
@@ -1,92 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
jbudorick 2015/01/21 02:39:34 Leave this one as-is for now. "gtest_test_run" is
rnephew (Wrong account) 2015/01/21 16:13:12 Done.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Run specific test on specific environment."""
-
-import logging
-import os
-import sys
-import tempfile
-
-from pylib import constants
-from pylib.base import base_test_result
-from pylib.remote.device import appurify_sanitized
-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."""
-
- DEFAULT_RUNNER_PACKAGE = (
- 'org.chromium.native_test.ChromeNativeTestInstrumentationTestRunner')
-
- #override
- def TestPackage(self):
- return self._test_instance.suite
-
- #override
- def _TriggerSetUp(self):
- """Set up the triggering of a test run."""
- logging.info('Triggering test run.')
-
- if self._env.runner_type:
- logging.warning('Ignoring configured runner_type "%s"',
- self._env.runner_type)
-
- if not self._env.runner_package:
- runner_package = self.DEFAULT_RUNNER_PACKAGE
- logging.info('Using default runner package: %s',
- self.DEFAULT_RUNNER_PACKAGE)
- else:
- runner_package = self._env.runner_package
-
- dummy_app_path = os.path.join(
- constants.GetOutDirectory(), 'apks', 'remote_device_dummy.apk')
- 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='
-
- #override
- def _ParseTestResults(self):
- logging.info('Parsing results from stdout.')
- results = base_test_result.TestRunResults()
- if self._results['results']['exception']:
- results.AddResult(base_test_result.BaseTestResult(
- self._results['results']['exception'],
- base_test_result.ResultType.FAIL))
- else:
- output = self._results['results']['output'].splitlines()
- output = (l[len(self._INSTRUMENTATION_STREAM_LEADER):] for l in output
- 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.',
- base_test_result.ResultType.FAIL))
- return results

Powered by Google App Engine
This is Rietveld 408576698