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

Side by Side Diff: build/android/provision_devices.py

Issue 495123002: [Android] Fix provisioning for perf bots on L and/or user builds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Provisions Android devices with settings required for bots. 7 """Provisions Android devices with settings required for bots.
8 8
9 Usage: 9 Usage:
10 ./provision_devices.py [-d <device serial number>] 10 ./provision_devices.py [-d <device serial number>]
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 (adb_keys[0], constants.ADB_KEYS_FILE), as_root=True) 131 (adb_keys[0], constants.ADB_KEYS_FILE), as_root=True)
132 for adb_key in adb_keys[1:]: 132 for adb_key in adb_keys[1:]:
133 device.RunShellCommand( 133 device.RunShellCommand(
134 'echo %s >> %s' % (adb_key, constants.ADB_KEYS_FILE), as_root=True) 134 'echo %s >> %s' % (adb_key, constants.ADB_KEYS_FILE), as_root=True)
135 device.RunShellCommand('restorecon %s' % constants.ADB_KEYS_FILE, 135 device.RunShellCommand('restorecon %s' % constants.ADB_KEYS_FILE,
136 as_root=True) 136 as_root=True)
137 137
138 138
139 def WipeDeviceIfPossible(device): 139 def WipeDeviceIfPossible(device):
140 try: 140 try:
141 device.EnableRoot() 141 device.EnableRoot()
jbudorick 2014/08/21 17:15:15 @tonyg: it'll skip the wipe here. if we can't enab
142 WipeDeviceData(device) 142 WipeDeviceData(device)
143 device.Reboot(True, timeout=180, retries=0) 143 # TODO(jbudorick): Tune the timeout per OS version.
144 device.Reboot(True, timeout=600, retries=0)
144 except (errors.DeviceUnresponsiveError, device_errors.CommandFailedError): 145 except (errors.DeviceUnresponsiveError, device_errors.CommandFailedError):
145 pass 146 pass
146 147
147 148
148 def ProvisionDevice(device, options, is_perf): 149 def ProvisionDevice(device, options, is_perf):
149 try: 150 try:
150 if not options.skip_wipe: 151 if not options.skip_wipe:
151 WipeDeviceIfPossible(device) 152 WipeDeviceIfPossible(device)
152 device.EnableRoot() 153 try:
154 device.EnableRoot()
tonyg 2014/08/21 17:12:58 I think the old code would skip the wipe if we cou
155 except device_errors.CommandFailedError as e:
156 logging.warning(str(e))
153 _ConfigureLocalProperties(device, is_perf) 157 _ConfigureLocalProperties(device, is_perf)
154 device_settings.ConfigureContentSettings( 158 device_settings.ConfigureContentSettings(
155 device, device_settings.DETERMINISTIC_DEVICE_SETTINGS) 159 device, device_settings.DETERMINISTIC_DEVICE_SETTINGS)
156 if options.disable_location: 160 if options.disable_location:
157 device_settings.ConfigureContentSettings( 161 device_settings.ConfigureContentSettings(
158 device, device_settings.DISABLE_LOCATION_SETTINGS) 162 device, device_settings.DISABLE_LOCATION_SETTINGS)
159 else: 163 else:
160 device_settings.ConfigureContentSettings( 164 device_settings.ConfigureContentSettings(
161 device, device_settings.ENABLE_LOCATION_SETTINGS) 165 device, device_settings.ENABLE_LOCATION_SETTINGS)
162 device_settings.SetLockScreenSettings(device) 166 device_settings.SetLockScreenSettings(device)
(...skipping 17 matching lines...) Expand all
180 if device.old_interface.CanControlUsbCharging(): 184 if device.old_interface.CanControlUsbCharging():
181 device.old_interface.EnableUsbCharging() 185 device.old_interface.EnableUsbCharging()
182 else: 186 else:
183 logging.error('Device is not charging') 187 logging.error('Device is not charging')
184 break 188 break
185 logging.info('Waiting for device to charge. Current level=%s', 189 logging.info('Waiting for device to charge. Current level=%s',
186 battery_info.get('level', 0)) 190 battery_info.get('level', 0))
187 time.sleep(60) 191 time.sleep(60)
188 battery_info = device.old_interface.GetBatteryInfo() 192 battery_info = device.old_interface.GetBatteryInfo()
189 device.RunShellCommand('date -u %f' % time.time(), as_root=True) 193 device.RunShellCommand('date -u %f' % time.time(), as_root=True)
190 device.Reboot(True, timeout=180, retries=0) 194 # TODO(jbudorick): Tune the timeout per OS version.
195 device.Reboot(True, timeout=600, retries=0)
191 props = device.RunShellCommand('getprop') 196 props = device.RunShellCommand('getprop')
192 for prop in props: 197 for prop in props:
193 logging.info(' %s' % prop) 198 logging.info(' %s' % prop)
194 if options.auto_reconnect: 199 if options.auto_reconnect:
195 PushAndLaunchAdbReboot(device, options.target) 200 PushAndLaunchAdbReboot(device, options.target)
196 except (errors.WaitForResponseTimedOutError, 201 except (errors.WaitForResponseTimedOutError,
197 device_errors.CommandTimeoutError): 202 device_errors.CommandTimeoutError):
198 logging.info('Timed out waiting for device %s. Adding to blacklist.', 203 logging.info('Timed out waiting for device %s. Adding to blacklist.',
199 str(device)) 204 str(device))
200 # Device black list is reset by bb_device_status_check.py per build. 205 # Device black list is reset by bb_device_status_check.py per build.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 249
245 if args: 250 if args:
246 print >> sys.stderr, 'Unused args %s' % args 251 print >> sys.stderr, 'Unused args %s' % args
247 return 1 252 return 1
248 253
249 return ProvisionDevices(options) 254 return ProvisionDevices(options)
250 255
251 256
252 if __name__ == '__main__': 257 if __name__ == '__main__':
253 sys.exit(main(sys.argv)) 258 sys.exit(main(sys.argv))
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