Chromium Code Reviews| Index: build/android/pylib/remote/device/remote_device_instrumentation_run.py |
| diff --git a/build/android/pylib/remote/device/remote_device_instrumentation_run.py b/build/android/pylib/remote/device/remote_device_instrumentation_run.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..46bccf07790bae55352a0d4297ec6a7d3c9e73a3 |
| --- /dev/null |
| +++ b/build/android/pylib/remote/device/remote_device_instrumentation_run.py |
| @@ -0,0 +1,56 @@ |
| +# Copyright 2014 The Chromium Authors. All rights reserved. |
|
jbudorick
2015/01/20 15:39:04
2015
rnephew (Wrong account)
2015/01/20 16:45:46
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 tempfile |
| + |
| +from pylib.base import base_test_result |
| + |
|
jbudorick
2015/01/20 15:39:04
nit: no empty line here
rnephew (Wrong account)
2015/01/20 16:45:46
Done.
|
| +from pylib.remote.device import remote_device_test_run |
| +from pylib.utils import apk_helper |
| + |
| + |
| +class RemoteDeviceInstrumentationRun( |
|
jbudorick
2015/01/20 15:39:04
nit: RemoteDeviceInstrumentationRun -> RemoteDevic
rnephew (Wrong account)
2015/01/20 16:45:46
Done.
|
| + remote_device_test_run.RemoteDeviceTestRun): |
| + """Run instrumentation tests on a remote device.""" |
| + |
| + #override |
| + def TestPackage(self): |
| + return self._test_instance.test_package |
| + |
| + #override |
| + def _TriggerSetUp(self): |
| + """Set up the triggering of a test run.""" |
| + logging.info('Triggering test run.') |
| + self._AmInstrumentTestSetup( |
| + self._test_instance._apk_under_test, self._test_instance.test_apk, |
| + self._test_instance.runner_runner, environment_variables={}) |
|
jbudorick
2015/01/20 15:39:03
runner_runner...?
rnephew (Wrong account)
2015/01/20 16:45:46
Done.
|
| + |
| + #override |
| + def _ParseTestResults(self): |
| + logging.info('Parsing results from stdout.') |
| + r = base_test_result.TestRunResults() |
| + |
| + if self._results['results']['exception']: |
| + r.AddResult(base_test_result.BaseTestResult( |
| + self._results['results']['exception'], |
| + base_test_result.ResultType.FAIL)) |
| + return r |
| + |
| + _, errors, parsed_output = self._test_instance.ParseAmInstrumentRawOutput( |
| + self._results['results']['output'].splitlines()) |
| + logging.info(errors) |
|
jbudorick
2015/01/20 15:39:04
This should either be:
- removed
- logged at deb
rnephew (Wrong account)
2015/01/20 16:45:46
Done.
|
| + result = self._test_instance.GenerateMultiTestResult(errors, parsed_output) |
| + |
| + if isinstance(result, base_test_result.BaseTestResult): |
| + r.AddResult(result) |
| + elif isinstance(result, list): |
| + r.AddResults(result) |
| + else: |
| + raise Exception('Unexpected result type: %s' % type(result).__name__) |
| + |
| + return r |