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

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

Issue 2791613003: [Instrumentation Test Speed] Install apks in parallel with concurrent_adb enabled (Closed)
Patch Set: Case comment Created 3 years, 8 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 logging 5 import logging
6 import os 6 import os
7 import posixpath 7 import posixpath
8 import re 8 import re
9 import time 9 import time
10 10
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 #override 68 #override
69 def TestPackage(self): 69 def TestPackage(self):
70 return self._test_instance.suite 70 return self._test_instance.suite
71 71
72 #override 72 #override
73 def SetUp(self): 73 def SetUp(self):
74 @local_device_environment.handle_shard_failures_with( 74 @local_device_environment.handle_shard_failures_with(
75 self._env.BlacklistDevice) 75 self._env.BlacklistDevice)
76 @trace_event.traced 76 @trace_event.traced
77 def individual_device_set_up(dev, host_device_tuples): 77 def individual_device_set_up(dev, host_device_tuples):
78 def install_apk(): 78 steps = []
79 if self._test_instance.apk_under_test: 79 def install_helper(apk, permissions):
80 if self._test_instance.apk_under_test_incremental_install_script: 80 return lambda: dev.Install(apk, permissions=permissions)
81 local_device_test_run.IncrementalInstall(
82 dev,
83 self._test_instance.apk_under_test,
84 self._test_instance.apk_under_test_incremental_install_script)
85 else:
86 permissions = self._test_instance.apk_under_test.GetPermissions()
87 dev.Install(self._test_instance.apk_under_test,
88 permissions=permissions)
89 81
90 if self._test_instance.test_apk_incremental_install_script: 82 if self._test_instance.apk_under_test:
91 local_device_test_run.IncrementalInstall( 83 if self._test_instance.apk_under_test_incremental_install_script:
92 dev, 84 steps.append(
93 self._test_instance.test_apk, 85 lambda: local_device_test_run.IncrementalInstall(
94 self._test_instance.test_apk_incremental_install_script) 86 dev,
87 self._test_instance.apk_under_test,
88 self._test_instance.
89 apk_under_test_incremental_install_script))
95 else: 90 else:
96 permissions = self._test_instance.test_apk.GetPermissions() 91 permissions = self._test_instance.apk_under_test.GetPermissions()
97 dev.Install(self._test_instance.test_apk, permissions=permissions) 92 steps.append(install_helper(self._test_instance.apk_under_test,
93 permissions))
98 94
99 for apk in self._test_instance.additional_apks: 95 if self._test_instance.test_apk_incremental_install_script:
100 dev.Install(apk) 96 steps.append(lambda: local_device_test_run.IncrementalInstall(
jbudorick 2017/04/10 19:02:54 optional nit: maybe move this into a helper for co
97 dev,
98 self._test_instance.test_apk,
99 self._test_instance.
100 test_apk_incremental_install_script))
101 else:
102 permissions = self._test_instance.test_apk.GetPermissions()
103 steps.append(install_helper(self._test_instance.test_apk,
104 permissions))
101 105
106 steps.extend([install_helper(apk, None)
agrieve 2017/04/10 18:37:06 nit: you don't need the []s here.
107 for apk in self._test_instance.additional_apks])
108
109 def set_debug_app():
102 # Set debug app in order to enable reading command line flags on user 110 # Set debug app in order to enable reading command line flags on user
103 # builds 111 # builds
104 if self._test_instance.flags: 112 if self._test_instance.flags:
105 if not self._test_instance.package_info: 113 if not self._test_instance.package_info:
106 logging.error("Couldn't set debug app: no package info") 114 logging.error("Couldn't set debug app: no package info")
107 elif not self._test_instance.package_info.package: 115 elif not self._test_instance.package_info.package:
108 logging.error("Couldn't set debug app: no package defined") 116 logging.error("Couldn't set debug app: no package defined")
109 else: 117 else:
110 dev.RunShellCommand(['am', 'set-debug-app', '--persistent', 118 dev.RunShellCommand(['am', 'set-debug-app', '--persistent',
111 self._test_instance.package_info.package], 119 self._test_instance.package_info.package],
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 logging.error("Couldn't set flags: no cmdline_file") 166 logging.error("Couldn't set flags: no cmdline_file")
159 else: 167 else:
160 self._CreateFlagChangerIfNeeded(dev) 168 self._CreateFlagChangerIfNeeded(dev)
161 logging.debug('Attempting to set flags: %r', 169 logging.debug('Attempting to set flags: %r',
162 self._test_instance.flags) 170 self._test_instance.flags)
163 self._flag_changers[str(dev)].AddFlags(self._test_instance.flags) 171 self._flag_changers[str(dev)].AddFlags(self._test_instance.flags)
164 172
165 valgrind_tools.SetChromeTimeoutScale( 173 valgrind_tools.SetChromeTimeoutScale(
166 dev, self._test_instance.timeout_scale) 174 dev, self._test_instance.timeout_scale)
167 175
168 steps = (install_apk, edit_shared_prefs, push_test_data, 176 steps += [set_debug_app, edit_shared_prefs, push_test_data,
169 create_flag_changer) 177 create_flag_changer]
170 if self._env.concurrent_adb: 178 if self._env.concurrent_adb:
171 reraiser_thread.RunAsync(steps) 179 reraiser_thread.RunAsync(steps)
172 else: 180 else:
173 for step in steps: 181 for step in steps:
174 step() 182 step()
175 if self._test_instance.store_tombstones: 183 if self._test_instance.store_tombstones:
176 tombstones.ClearAllTombstones(dev) 184 tombstones.ClearAllTombstones(dev)
177 185
178 self._env.parallel_devices.pMap( 186 self._env.parallel_devices.pMap(
179 individual_device_set_up, 187 individual_device_set_up,
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 if k in annotations: 439 if k in annotations:
432 timeout = v 440 timeout = v
433 break 441 break
434 else: 442 else:
435 logging.warning('Using default 1 minute timeout for %s', test_name) 443 logging.warning('Using default 1 minute timeout for %s', test_name)
436 timeout = 60 444 timeout = 60
437 445
438 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) 446 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations)
439 447
440 return timeout 448 return timeout
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698