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

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: agrieve & jbudorick 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( 81 def incremental_install_helper(dev, apk, script):
82 dev, 82 return lambda: local_device_test_run.IncrementalInstall(
83 self._test_instance.apk_under_test, 83 dev, apk, script)
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 84
90 if self._test_instance.test_apk_incremental_install_script: 85 if self._test_instance.apk_under_test:
91 local_device_test_run.IncrementalInstall( 86 if self._test_instance.apk_under_test_incremental_install_script:
92 dev, 87 steps.append(incremental_install_helper(
93 self._test_instance.test_apk, 88 dev,
94 self._test_instance.test_apk_incremental_install_script) 89 self._test_instance.apk_under_test,
90 self._test_instance.
91 apk_under_test_incremental_install_script))
95 else: 92 else:
96 permissions = self._test_instance.test_apk.GetPermissions() 93 permissions = self._test_instance.apk_under_test.GetPermissions()
97 dev.Install(self._test_instance.test_apk, permissions=permissions) 94 steps.append(install_helper(self._test_instance.apk_under_test,
95 permissions))
98 96
99 for apk in self._test_instance.additional_apks: 97 if self._test_instance.test_apk_incremental_install_script:
100 dev.Install(apk) 98 steps.append(incremental_install_helper(
99 dev,
100 self._test_instance.test_apk,
101 self._test_instance.
102 test_apk_incremental_install_script))
103 else:
104 permissions = self._test_instance.test_apk.GetPermissions()
105 steps.append(install_helper(self._test_instance.test_apk,
106 permissions))
101 107
108 steps.extend(install_helper(apk, None)
109 for apk in self._test_instance.additional_apks)
110
111 def set_debug_app():
102 # Set debug app in order to enable reading command line flags on user 112 # Set debug app in order to enable reading command line flags on user
103 # builds 113 # builds
104 if self._test_instance.flags: 114 if self._test_instance.flags:
105 if not self._test_instance.package_info: 115 if not self._test_instance.package_info:
106 logging.error("Couldn't set debug app: no package info") 116 logging.error("Couldn't set debug app: no package info")
107 elif not self._test_instance.package_info.package: 117 elif not self._test_instance.package_info.package:
108 logging.error("Couldn't set debug app: no package defined") 118 logging.error("Couldn't set debug app: no package defined")
109 else: 119 else:
110 dev.RunShellCommand(['am', 'set-debug-app', '--persistent', 120 dev.RunShellCommand(['am', 'set-debug-app', '--persistent',
111 self._test_instance.package_info.package], 121 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") 168 logging.error("Couldn't set flags: no cmdline_file")
159 else: 169 else:
160 self._CreateFlagChangerIfNeeded(dev) 170 self._CreateFlagChangerIfNeeded(dev)
161 logging.debug('Attempting to set flags: %r', 171 logging.debug('Attempting to set flags: %r',
162 self._test_instance.flags) 172 self._test_instance.flags)
163 self._flag_changers[str(dev)].AddFlags(self._test_instance.flags) 173 self._flag_changers[str(dev)].AddFlags(self._test_instance.flags)
164 174
165 valgrind_tools.SetChromeTimeoutScale( 175 valgrind_tools.SetChromeTimeoutScale(
166 dev, self._test_instance.timeout_scale) 176 dev, self._test_instance.timeout_scale)
167 177
168 steps = (install_apk, edit_shared_prefs, push_test_data, 178 steps += [set_debug_app, edit_shared_prefs, push_test_data,
169 create_flag_changer) 179 create_flag_changer]
170 if self._env.concurrent_adb: 180 if self._env.concurrent_adb:
171 reraiser_thread.RunAsync(steps) 181 reraiser_thread.RunAsync(steps)
172 else: 182 else:
173 for step in steps: 183 for step in steps:
174 step() 184 step()
175 if self._test_instance.store_tombstones: 185 if self._test_instance.store_tombstones:
176 tombstones.ClearAllTombstones(dev) 186 tombstones.ClearAllTombstones(dev)
177 187
178 self._env.parallel_devices.pMap( 188 self._env.parallel_devices.pMap(
179 individual_device_set_up, 189 individual_device_set_up,
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 if k in annotations: 441 if k in annotations:
432 timeout = v 442 timeout = v
433 break 443 break
434 else: 444 else:
435 logging.warning('Using default 1 minute timeout for %s', test_name) 445 logging.warning('Using default 1 minute timeout for %s', test_name)
436 timeout = 60 446 timeout = 60
437 447
438 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) 448 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations)
439 449
440 return timeout 450 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