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 import itertools | 5 import itertools |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 import posixpath | 8 import posixpath |
9 | 9 |
10 from devil.android import device_errors | 10 from devil.android import device_errors |
11 from devil.android import device_temp_file | 11 from devil.android import device_temp_file |
12 from devil.android import ports | 12 from devil.android import ports |
13 from pylib import constants | 13 from pylib import constants |
14 from pylib.base import test_run | |
15 from pylib.gtest import gtest_test_instance | 14 from pylib.gtest import gtest_test_instance |
16 from pylib.local import local_test_server_spawner | 15 from pylib.local import local_test_server_spawner |
17 from pylib.local.device import local_device_environment | 16 from pylib.local.device import local_device_environment |
18 from pylib.local.device import local_device_test_run | 17 from pylib.local.device import local_device_test_run |
19 | 18 |
20 _COMMAND_LINE_FLAGS_SUPPORTED = True | 19 _COMMAND_LINE_FLAGS_SUPPORTED = True |
21 | 20 |
22 _EXTRA_COMMAND_LINE_FILE = ( | 21 _EXTRA_COMMAND_LINE_FILE = ( |
23 'org.chromium.native_test.NativeTestActivity.CommandLineFile') | 22 'org.chromium.native_test.NativeTestActivity.CommandLineFile') |
24 _EXTRA_COMMAND_LINE_FLAGS = ( | 23 _EXTRA_COMMAND_LINE_FLAGS = ( |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 external = device.GetExternalStoragePath() | 126 external = device.GetExternalStoragePath() |
128 env['GCOV_PREFIX'] = '%s/gcov' % external | 127 env['GCOV_PREFIX'] = '%s/gcov' % external |
129 env['GCOV_PREFIX_STRIP'] = gcov_strip_depth | 128 env['GCOV_PREFIX_STRIP'] = gcov_strip_depth |
130 except (device_errors.CommandFailedError, KeyError): | 129 except (device_errors.CommandFailedError, KeyError): |
131 pass | 130 pass |
132 | 131 |
133 # TODO(jbudorick): Switch to just RunShellCommand once perezju@'s CL | 132 # TODO(jbudorick): Switch to just RunShellCommand once perezju@'s CL |
134 # for long shell commands lands. | 133 # for long shell commands lands. |
135 with device_temp_file.DeviceTempFile(device.adb) as script_file: | 134 with device_temp_file.DeviceTempFile(device.adb) as script_file: |
136 script_contents = ' '.join(cmd) | 135 script_contents = ' '.join(cmd) |
137 logging.info('script contents: %r' % script_contents) | 136 logging.info('script contents: %r', script_contents) |
138 device.WriteFile(script_file.name, script_contents) | 137 device.WriteFile(script_file.name, script_contents) |
139 output = device.RunShellCommand(['sh', script_file.name], cwd=cwd, | 138 output = device.RunShellCommand(['sh', script_file.name], cwd=cwd, |
140 env=env, **kwargs) | 139 env=env, **kwargs) |
141 return output | 140 return output |
142 | 141 |
143 def PullAppFiles(self, device, files, directory): | 142 def PullAppFiles(self, device, files, directory): |
144 pass | 143 pass |
145 | 144 |
146 def Clear(self, device): | 145 def Clear(self, device): |
147 device.KillAll(self._exe_file_name, blocking=True, timeout=30, quiet=True) | 146 device.KillAll(self._exe_file_name, blocking=True, timeout=30, quiet=True) |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 return results | 231 return results |
233 | 232 |
234 #override | 233 #override |
235 def TearDown(self): | 234 def TearDown(self): |
236 def individual_device_tear_down(dev): | 235 def individual_device_tear_down(dev): |
237 for s in self._servers[str(dev)]: | 236 for s in self._servers[str(dev)]: |
238 s.TearDown() | 237 s.TearDown() |
239 | 238 |
240 self._env.parallel_devices.pMap(individual_device_tear_down) | 239 self._env.parallel_devices.pMap(individual_device_tear_down) |
241 | 240 |
OLD | NEW |