Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 """Run specific test on specific environment.""" | |
| 6 | |
| 7 import logging | |
| 8 import os | |
| 9 import tempfile | |
| 10 | |
| 11 from pylib.base import base_test_result | |
| 12 | |
| 13 from pylib.remote.device import remote_device_test_run | |
| 14 from pylib.utils import apk_helper | |
| 15 | |
| 16 | |
| 17 class RemoteDeviceInstrumentationRun( | |
| 18 remote_device_test_run.RemoteDeviceTestRun): | |
| 19 """Run instrumentation tests on a remote device.""" | |
| 20 | |
| 21 #override | |
| 22 def TestPackage(self): | |
| 23 return self._test_instance.test_package | |
| 24 | |
| 25 #override | |
| 26 def _TriggerSetUp(self): | |
| 27 """Set up the triggering of a test run.""" | |
| 28 | |
| 29 logging.info('Triggering test run.') | |
| 30 runner_package = self._test_instance.test_runner | |
|
jbudorick
2015/01/16 22:24:48
what's the point of doing this outside of the func
rnephew (Wrong account)
2015/01/16 22:36:38
I was originally doing other stuff, but got rid of
| |
| 31 | |
| 32 self._AmInstrumentTestSetup( | |
| 33 self._test_instance._apk_under_test, self._test_instance.test_apk, | |
| 34 runner_package, environment_variables={}) | |
| 35 | |
| 36 #override | |
| 37 def _ParseTestResults(self): | |
| 38 logging.info('Parsing results from stdout.') | |
| 39 r = base_test_result.TestRunResults() | |
| 40 | |
| 41 if self._results['results']['exception']: | |
| 42 r.AddResult(base_test_result.BaseTestResult( | |
| 43 self._results['results']['exception'], | |
| 44 base_test_result.ResultType.FAIL)) | |
| 45 return r | |
| 46 | |
| 47 _, errors, parsed_output = self._test_instance.ParseAmInstrumentRawOutput( | |
| 48 self._results['results']['output'].splitlines()) | |
| 49 result = self._test_instance.GenerateMultiTestResult(errors, parsed_output) | |
| 50 | |
| 51 if isinstance(result, base_test_result.BaseTestResult): | |
| 52 r.AddResult(result) | |
| 53 elif isinstance(result, list): | |
| 54 r.AddResults(result) | |
| 55 else: | |
| 56 raise Exception('Unexpected result type: %s' % type(result).__name__) | |
| 57 | |
| 58 return r | |
| OLD | NEW |