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 collections | 5 import collections |
6 import itertools | 6 import itertools |
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 |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
233 def SetUp(self): | 233 def SetUp(self): |
234 @local_device_test_run.handle_shard_failures_with( | 234 @local_device_test_run.handle_shard_failures_with( |
235 on_failure=self._env.BlacklistDevice) | 235 on_failure=self._env.BlacklistDevice) |
236 def individual_device_set_up(dev): | 236 def individual_device_set_up(dev): |
237 def install_apk(): | 237 def install_apk(): |
238 # Install test APK. | 238 # Install test APK. |
239 self._delegate.Install(dev) | 239 self._delegate.Install(dev) |
240 | 240 |
241 def push_test_data(): | 241 def push_test_data(): |
242 # Push data dependencies. | 242 # Push data dependencies. |
243 external_storage = dev.GetExternalStoragePath() | 243 device_root = posixpath.join(dev.GetExternalStoragePath(), 'gtestdata') |
244 data_deps = self._test_instance.GetDataDependencies() | 244 data_deps = self._test_instance.GetDataDependencies() |
245 host_device_tuples = [ | 245 host_device_tuples = [ |
246 (h, d if d is not None else external_storage) | 246 (h, d if d is not None else device_root) |
247 for h, d in data_deps] | 247 for h, d in data_deps] |
248 dev.PushChangedFiles(host_device_tuples) | 248 dev.PushChangedFiles(host_device_tuples, delete_device_stale=True) |
249 if not host_device_tuples: | |
250 dev.RunShellCommand('r=%s;rm -rf $r;mkdir -p $r' % device_root) | |
jbudorick
2016/04/27 19:59:01
I'm assuming this is the motivation for gtestdata.
agrieve
2016/04/27 20:26:31
The delete_device_stale=True part is the motivatio
jbudorick
2016/04/27 20:41:36
I meant the rm -rf portion more than the mkdir por
agrieve
2016/04/29 15:56:35
Alright, I don't think this will be a case that sl
| |
249 | 251 |
250 def init_tool_and_start_servers(): | 252 def init_tool_and_start_servers(): |
251 tool = self.GetTool(dev) | 253 tool = self.GetTool(dev) |
252 tool.CopyFiles(dev) | 254 tool.CopyFiles(dev) |
253 tool.SetupEnvironment() | 255 tool.SetupEnvironment() |
254 | 256 |
255 self._servers[str(dev)] = [] | 257 self._servers[str(dev)] = [] |
256 if self.TestPackage() in _SUITE_REQUIRES_TEST_SERVER_SPAWNER: | 258 if self.TestPackage() in _SUITE_REQUIRES_TEST_SERVER_SPAWNER: |
257 self._servers[str(dev)].append( | 259 self._servers[str(dev)].append( |
258 local_test_server_spawner.LocalTestServerSpawner( | 260 local_test_server_spawner.LocalTestServerSpawner( |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
356 def TearDown(self): | 358 def TearDown(self): |
357 @local_device_test_run.handle_shard_failures | 359 @local_device_test_run.handle_shard_failures |
358 def individual_device_tear_down(dev): | 360 def individual_device_tear_down(dev): |
359 for s in self._servers.get(str(dev), []): | 361 for s in self._servers.get(str(dev), []): |
360 s.TearDown() | 362 s.TearDown() |
361 | 363 |
362 tool = self.GetTool(dev) | 364 tool = self.GetTool(dev) |
363 tool.CleanUpEnvironment() | 365 tool.CleanUpEnvironment() |
364 | 366 |
365 self._env.parallel_devices.pMap(individual_device_tear_down) | 367 self._env.parallel_devices.pMap(individual_device_tear_down) |
OLD | NEW |