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 logging | 7 import logging |
8 import os | 8 import os |
9 import posixpath | 9 import posixpath |
10 | 10 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 def SetUp(self): | 234 def SetUp(self): |
235 @local_device_test_run.handle_shard_failures_with( | 235 @local_device_test_run.handle_shard_failures_with( |
236 on_failure=self._env.BlacklistDevice) | 236 on_failure=self._env.BlacklistDevice) |
237 def individual_device_set_up(dev): | 237 def individual_device_set_up(dev): |
238 def install_apk(): | 238 def install_apk(): |
239 # Install test APK. | 239 # Install test APK. |
240 self._delegate.Install(dev) | 240 self._delegate.Install(dev) |
241 | 241 |
242 def push_test_data(): | 242 def push_test_data(): |
243 # Push data dependencies. | 243 # Push data dependencies. |
244 external_storage = dev.GetExternalStoragePath() | 244 device_root = posixpath.join(dev.GetExternalStoragePath(), |
| 245 'chromium_tests_root') |
245 data_deps = self._test_instance.GetDataDependencies() | 246 data_deps = self._test_instance.GetDataDependencies() |
246 host_device_tuples = [ | 247 host_device_tuples = [ |
247 (h, d if d is not None else external_storage) | 248 (h, d if d is not None else device_root) |
248 for h, d in data_deps] | 249 for h, d in data_deps] |
249 dev.PushChangedFiles(host_device_tuples) | 250 dev.PushChangedFiles(host_device_tuples, delete_device_stale=True) |
| 251 if not host_device_tuples: |
| 252 dev.RunShellCommand(['rm', '-rf', device_root], check_return=True) |
| 253 dev.RunShellCommand(['mkdir', '-p', device_root], check_return=True) |
250 | 254 |
251 def init_tool_and_start_servers(): | 255 def init_tool_and_start_servers(): |
252 tool = self.GetTool(dev) | 256 tool = self.GetTool(dev) |
253 tool.CopyFiles(dev) | 257 tool.CopyFiles(dev) |
254 tool.SetupEnvironment() | 258 tool.SetupEnvironment() |
255 | 259 |
256 self._servers[str(dev)] = [] | 260 self._servers[str(dev)] = [] |
257 if self.TestPackage() in _SUITE_REQUIRES_TEST_SERVER_SPAWNER: | 261 if self.TestPackage() in _SUITE_REQUIRES_TEST_SERVER_SPAWNER: |
258 self._servers[str(dev)].append( | 262 self._servers[str(dev)].append( |
259 local_test_server_spawner.LocalTestServerSpawner( | 263 local_test_server_spawner.LocalTestServerSpawner( |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 def TearDown(self): | 365 def TearDown(self): |
362 @local_device_test_run.handle_shard_failures | 366 @local_device_test_run.handle_shard_failures |
363 def individual_device_tear_down(dev): | 367 def individual_device_tear_down(dev): |
364 for s in self._servers.get(str(dev), []): | 368 for s in self._servers.get(str(dev), []): |
365 s.TearDown() | 369 s.TearDown() |
366 | 370 |
367 tool = self.GetTool(dev) | 371 tool = self.GetTool(dev) |
368 tool.CleanUpEnvironment() | 372 tool.CleanUpEnvironment() |
369 | 373 |
370 self._env.parallel_devices.pMap(individual_device_tear_down) | 374 self._env.parallel_devices.pMap(individual_device_tear_down) |
OLD | NEW |