Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Side by Side Diff: build/android/pylib/local/device/local_device_gtest_run.py

Issue 2514453003: Revert of [android] Stop using isolate.py for data dependency management. (Closed)
Patch Set: manual rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 self._servers = collections.defaultdict(list) 244 self._servers = collections.defaultdict(list)
245 245
246 #override 246 #override
247 def TestPackage(self): 247 def TestPackage(self):
248 return self._test_instance.suite 248 return self._test_instance.suite
249 249
250 #override 250 #override
251 def SetUp(self): 251 def SetUp(self):
252 @local_device_environment.handle_shard_failures_with( 252 @local_device_environment.handle_shard_failures_with(
253 on_failure=self._env.BlacklistDevice) 253 on_failure=self._env.BlacklistDevice)
254 def individual_device_set_up(dev, host_device_tuples): 254 def individual_device_set_up(dev):
255 def install_apk(): 255 def install_apk():
256 # Install test APK. 256 # Install test APK.
257 self._delegate.Install(dev) 257 self._delegate.Install(dev)
258 258
259 def push_test_data(): 259 def push_test_data():
260 # Push data dependencies. 260 # Push data dependencies.
261 device_root = self._delegate.GetTestDataRoot(dev) 261 device_root = self._delegate.GetTestDataRoot(dev)
262 host_device_tuples_substituted = [ 262 data_deps = self._test_instance.GetDataDependencies()
263 (h, local_device_test_run.SubstituteDeviceRoot(d, device_root)) 263 host_device_tuples = [
264 for h, d in host_device_tuples] 264 (h, d if d is not None else device_root)
265 dev.PushChangedFiles( 265 for h, d in data_deps]
266 host_device_tuples_substituted, 266 dev.PushChangedFiles(host_device_tuples, delete_device_stale=True)
267 delete_device_stale=True)
268 if not host_device_tuples: 267 if not host_device_tuples:
269 dev.RunShellCommand(['rm', '-rf', device_root], check_return=True) 268 dev.RunShellCommand(['rm', '-rf', device_root], check_return=True)
270 dev.RunShellCommand(['mkdir', '-p', device_root], check_return=True) 269 dev.RunShellCommand(['mkdir', '-p', device_root], check_return=True)
271 270
272 def init_tool_and_start_servers(): 271 def init_tool_and_start_servers():
273 tool = self.GetTool(dev) 272 tool = self.GetTool(dev)
274 tool.CopyFiles(dev) 273 tool.CopyFiles(dev)
275 tool.SetupEnvironment() 274 tool.SetupEnvironment()
276 275
277 self._servers[str(dev)] = [] 276 self._servers[str(dev)] = []
278 if self.TestPackage() in _SUITE_REQUIRES_TEST_SERVER_SPAWNER: 277 if self.TestPackage() in _SUITE_REQUIRES_TEST_SERVER_SPAWNER:
279 self._servers[str(dev)].append( 278 self._servers[str(dev)].append(
280 local_test_server_spawner.LocalTestServerSpawner( 279 local_test_server_spawner.LocalTestServerSpawner(
281 ports.AllocateTestServerPort(), dev, tool)) 280 ports.AllocateTestServerPort(), dev, tool))
282 281
283 for s in self._servers[str(dev)]: 282 for s in self._servers[str(dev)]:
284 s.SetUp() 283 s.SetUp()
285 284
286 steps = (install_apk, push_test_data, init_tool_and_start_servers) 285 steps = (install_apk, push_test_data, init_tool_and_start_servers)
287 if self._env.concurrent_adb: 286 if self._env.concurrent_adb:
288 reraiser_thread.RunAsync(steps) 287 reraiser_thread.RunAsync(steps)
289 else: 288 else:
290 for step in steps: 289 for step in steps:
291 step() 290 step()
292 291
293 self._env.parallel_devices.pMap( 292 self._env.parallel_devices.pMap(individual_device_set_up)
294 individual_device_set_up,
295 self._test_instance.GetDataDependencies())
296 293
297 #override 294 #override
298 def _ShouldShard(self): 295 def _ShouldShard(self):
299 return True 296 return True
300 297
301 #override 298 #override
302 def _CreateShards(self, tests): 299 def _CreateShards(self, tests):
303 # _crashes are tests that might crash and make the tests in the same shard 300 # _crashes are tests that might crash and make the tests in the same shard
304 # following the crashed testcase not run. 301 # following the crashed testcase not run.
305 # Thus we need to create separate shards for each crashed testcase, 302 # Thus we need to create separate shards for each crashed testcase,
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 def TearDown(self): 413 def TearDown(self):
417 @local_device_environment.handle_shard_failures 414 @local_device_environment.handle_shard_failures
418 def individual_device_tear_down(dev): 415 def individual_device_tear_down(dev):
419 for s in self._servers.get(str(dev), []): 416 for s in self._servers.get(str(dev), []):
420 s.TearDown() 417 s.TearDown()
421 418
422 tool = self.GetTool(dev) 419 tool = self.GetTool(dev)
423 tool.CleanUpEnvironment() 420 tool.CleanUpEnvironment()
424 421
425 self._env.parallel_devices.pMap(individual_device_tear_down) 422 self._env.parallel_devices.pMap(individual_device_tear_down)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698