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

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: John & 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)
mikecase (-- gone --) 2017/04/08 00:50:12 super nit: I think you should put empty line after
shenghuazhang 2017/04/08 01:29:35 Done.
81 local_device_test_run.IncrementalInstall( 81 if self._test_instance.apk_under_test:
82 dev, 82 if self._test_instance.apk_under_test_incremental_install_script:
83 self._test_instance.apk_under_test, 83 steps.append(lambda: local_device_test_run.IncrementalInstall(
84 self._test_instance.apk_under_test_incremental_install_script) 84 dev,
85 else: 85 self._test_instance.apk_under_test,
86 permissions = self._test_instance.apk_under_test.GetPermissions() 86 self._test_instance.
87 dev.Install(self._test_instance.apk_under_test, 87 apk_under_test_incremental_install_script))
mikecase (-- gone --) 2017/04/08 00:50:12 nit: i think this line should be intented more tha
shenghuazhang 2017/04/08 01:29:35 This change pushes above 80 characters. Will move
88 permissions=permissions) 88 else:
89 permissions = self._test_instance.apk_under_test.GetPermissions()
90 steps.append(install_helper(self._test_instance.apk_under_test,
91 permissions))
89 92
90 if self._test_instance.test_apk_incremental_install_script: 93 if self._test_instance.test_apk_incremental_install_script:
91 local_device_test_run.IncrementalInstall( 94 steps.append(lambda: local_device_test_run.IncrementalInstall(
92 dev, 95 dev,
93 self._test_instance.test_apk, 96 self._test_instance.test_apk,
94 self._test_instance.test_apk_incremental_install_script) 97 self._test_instance.
95 else: 98 test_apk_incremental_install_script))
mikecase (-- gone --) 2017/04/08 00:50:12 nit: i think this line should be intented more tha
shenghuazhang 2017/04/08 01:29:35 This one is fine.
96 permissions = self._test_instance.test_apk.GetPermissions() 99 else:
97 dev.Install(self._test_instance.test_apk, permissions=permissions) 100 permissions = self._test_instance.test_apk.GetPermissions()
101 steps.append(install_helper(self._test_instance.test_apk,
102 permissions))
98 103
99 for apk in self._test_instance.additional_apks: 104 steps.extend([install_helper(apk, None)
100 dev.Install(apk) 105 for apk in self._test_instance.additional_apks])
101 106
107 def set_debug_app():
102 # Set debug app in order to enable reading command line flags on user 108 # Set debug app in order to enable reading command line flags on user
103 # builds 109 # builds
104 if self._test_instance.flags: 110 if self._test_instance.flags:
105 if not self._test_instance.package_info: 111 if not self._test_instance.package_info:
106 logging.error("Couldn't set debug app: no package info") 112 logging.error("Couldn't set debug app: no package info")
107 elif not self._test_instance.package_info.package: 113 elif not self._test_instance.package_info.package:
108 logging.error("Couldn't set debug app: no package defined") 114 logging.error("Couldn't set debug app: no package defined")
109 else: 115 else:
110 dev.RunShellCommand(['am', 'set-debug-app', '--persistent', 116 dev.RunShellCommand(['am', 'set-debug-app', '--persistent',
111 self._test_instance.package_info.package], 117 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") 164 logging.error("Couldn't set flags: no cmdline_file")
159 else: 165 else:
160 self._CreateFlagChangerIfNeeded(dev) 166 self._CreateFlagChangerIfNeeded(dev)
161 logging.debug('Attempting to set flags: %r', 167 logging.debug('Attempting to set flags: %r',
162 self._test_instance.flags) 168 self._test_instance.flags)
163 self._flag_changers[str(dev)].AddFlags(self._test_instance.flags) 169 self._flag_changers[str(dev)].AddFlags(self._test_instance.flags)
164 170
165 valgrind_tools.SetChromeTimeoutScale( 171 valgrind_tools.SetChromeTimeoutScale(
166 dev, self._test_instance.timeout_scale) 172 dev, self._test_instance.timeout_scale)
167 173
168 steps = (install_apk, edit_shared_prefs, push_test_data, 174 steps += [set_debug_app, edit_shared_prefs, push_test_data,
169 create_flag_changer) 175 create_flag_changer]
170 if self._env.concurrent_adb: 176 if self._env.concurrent_adb:
171 reraiser_thread.RunAsync(steps) 177 reraiser_thread.RunAsync(steps)
172 else: 178 else:
173 for step in steps: 179 for step in steps:
174 step() 180 step()
175 if self._test_instance.store_tombstones: 181 if self._test_instance.store_tombstones:
176 tombstones.ClearAllTombstones(dev) 182 tombstones.ClearAllTombstones(dev)
177 183
178 self._env.parallel_devices.pMap( 184 self._env.parallel_devices.pMap(
179 individual_device_set_up, 185 individual_device_set_up,
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 if k in annotations: 437 if k in annotations:
432 timeout = v 438 timeout = v
433 break 439 break
434 else: 440 else:
435 logging.warning('Using default 1 minute timeout for %s', test_name) 441 logging.warning('Using default 1 minute timeout for %s', test_name)
436 timeout = 60 442 timeout = 60
437 443
438 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) 444 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations)
439 445
440 return timeout 446 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