OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Run specific test on specific environment.""" | 5 """Run specific test on specific environment.""" |
6 | 6 |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import tempfile | 9 import tempfile |
10 | 10 |
11 from devil.android import apk_helper | |
12 from pylib import constants | |
13 from pylib.base import base_test_result | 11 from pylib.base import base_test_result |
14 from pylib.remote.device import remote_device_test_run | 12 from pylib.remote.device import remote_device_test_run |
15 | 13 |
16 | 14 |
17 class RemoteDeviceInstrumentationTestRun( | 15 class RemoteDeviceInstrumentationTestRun( |
18 remote_device_test_run.RemoteDeviceTestRun): | 16 remote_device_test_run.RemoteDeviceTestRun): |
19 """Run instrumentation tests on a remote device.""" | 17 """Run instrumentation tests on a remote device.""" |
20 | 18 |
21 #override | 19 #override |
22 def TestPackage(self): | 20 def TestPackage(self): |
23 return self._test_instance.test_package | 21 return self._test_instance.test_package |
24 | 22 |
25 #override | 23 #override |
26 def _TriggerSetUp(self): | 24 def _TriggerSetUp(self): |
27 """Set up the triggering of a test run.""" | 25 """Set up the triggering of a test run.""" |
28 logging.info('Triggering test run.') | 26 logging.info('Triggering test run.') |
29 | 27 |
| 28 # pylint: disable=protected-access |
30 with tempfile.NamedTemporaryFile(suffix='.txt') as test_list_file: | 29 with tempfile.NamedTemporaryFile(suffix='.txt') as test_list_file: |
31 tests = self._test_instance.GetTests() | 30 tests = self._test_instance.GetTests() |
32 logging.debug('preparing to run %d instrumentation tests remotely:', | 31 logging.debug('preparing to run %d instrumentation tests remotely:', |
33 len(tests)) | 32 len(tests)) |
34 for t in tests: | 33 for t in tests: |
35 test_name = '%s#%s' % (t['class'], t['method']) | 34 test_name = '%s#%s' % (t['class'], t['method']) |
36 logging.debug(' %s', test_name) | 35 logging.debug(' %s', test_name) |
37 test_list_file.write('%s\n' % test_name) | 36 test_list_file.write('%s\n' % test_name) |
38 test_list_file.flush() | 37 test_list_file.flush() |
39 self._test_instance._data_deps.append( | 38 self._test_instance._data_deps.append( |
(...skipping 26 matching lines...) Expand all Loading... |
66 | 65 |
67 if isinstance(result, base_test_result.BaseTestResult): | 66 if isinstance(result, base_test_result.BaseTestResult): |
68 r.AddResult(result) | 67 r.AddResult(result) |
69 elif isinstance(result, list): | 68 elif isinstance(result, list): |
70 r.AddResults(result) | 69 r.AddResults(result) |
71 else: | 70 else: |
72 raise Exception('Unexpected result type: %s' % type(result).__name__) | 71 raise Exception('Unexpected result type: %s' % type(result).__name__) |
73 | 72 |
74 self._DetectPlatformErrors(r) | 73 self._DetectPlatformErrors(r) |
75 return r | 74 return r |
OLD | NEW |