OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 | 5 |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 | 8 |
9 from pylib import constants | 9 from pylib import constants |
10 from pylib import ports | 10 from pylib import ports |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 # for long shell commands lands. | 105 # for long shell commands lands. |
106 with device_temp_file.DeviceTempFile(device.adb) as script_file: | 106 with device_temp_file.DeviceTempFile(device.adb) as script_file: |
107 script_contents = ' '.join(cmd) | 107 script_contents = ' '.join(cmd) |
108 logging.info('script contents: %r' % script_contents) | 108 logging.info('script contents: %r' % script_contents) |
109 device.WriteFile(script_file.name, script_contents) | 109 device.WriteFile(script_file.name, script_contents) |
110 output = device.RunShellCommand(['sh', script_file.name], cwd=cwd, | 110 output = device.RunShellCommand(['sh', script_file.name], cwd=cwd, |
111 env=env, **kwargs) | 111 env=env, **kwargs) |
112 return output | 112 return output |
113 | 113 |
114 def Clear(self, device): | 114 def Clear(self, device): |
115 try: | 115 device.KillAll(self._exe_file_name, blocking=True, timeout=30, quiet=True) |
116 device.KillAll(self._exe_file_name, blocking=True, timeout=30, retries=0) | |
117 except device_errors.CommandFailedError: | |
118 # Raised if there is no process with the given name, which in this case | |
119 # is all we care about. | |
120 pass | |
121 | 116 |
122 | 117 |
123 class LocalDeviceGtestRun(local_device_test_run.LocalDeviceTestRun): | 118 class LocalDeviceGtestRun(local_device_test_run.LocalDeviceTestRun): |
124 | 119 |
125 def __init__(self, env, test_instance): | 120 def __init__(self, env, test_instance): |
126 assert isinstance(env, local_device_environment.LocalDeviceEnvironment) | 121 assert isinstance(env, local_device_environment.LocalDeviceEnvironment) |
127 assert isinstance(test_instance, gtest_test_instance.GtestTestInstance) | 122 assert isinstance(test_instance, gtest_test_instance.GtestTestInstance) |
128 super(LocalDeviceGtestRun, self).__init__(env, test_instance) | 123 super(LocalDeviceGtestRun, self).__init__(env, test_instance) |
129 | 124 |
130 if self._test_instance.apk: | 125 if self._test_instance.apk: |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 return results | 196 return results |
202 | 197 |
203 #override | 198 #override |
204 def TearDown(self): | 199 def TearDown(self): |
205 def individual_device_tear_down(dev): | 200 def individual_device_tear_down(dev): |
206 for s in self._servers[str(dev)]: | 201 for s in self._servers[str(dev)]: |
207 s.TearDown() | 202 s.TearDown() |
208 | 203 |
209 self._env.parallel_devices.pMap(individual_device_tear_down) | 204 self._env.parallel_devices.pMap(individual_device_tear_down) |
210 | 205 |
OLD | NEW |