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

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

Issue 1141793003: Update from https://crrev.com/329939 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 7 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 | « build/android/gyp/write_ordered_libraries.py ('k') | build/android/pylib/base/base_setup.py » ('j') | 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 device_settings.ConfigureContentSettings( 177 device_settings.ConfigureContentSettings(
178 device, device_settings.NETWORK_DISABLED_SETTINGS) 178 device, device_settings.NETWORK_DISABLED_SETTINGS)
179 179
180 if options.min_battery_level is not None: 180 if options.min_battery_level is not None:
181 try: 181 try:
182 battery = battery_utils.BatteryUtils(device) 182 battery = battery_utils.BatteryUtils(device)
183 battery.ChargeDeviceToLevel(options.min_battery_level) 183 battery.ChargeDeviceToLevel(options.min_battery_level)
184 except device_errors.CommandFailedError as e: 184 except device_errors.CommandFailedError as e:
185 logging.exception('Unable to charge device to specified level.') 185 logging.exception('Unable to charge device to specified level.')
186 186
187 if options.max_battery_temp is not None:
188 try:
189 battery = battery_utils.BatteryUtils(device)
190 battery.LetBatteryCoolToTemperature(options.max_battery_temp)
191 except device_errors.CommandFailedError as e:
192 logging.exception('Unable to let battery cool to specified temperature.')
187 193
188 def _ConfigureLocalProperties(device, java_debug=True): 194 def _ConfigureLocalProperties(device, java_debug=True):
189 """Set standard readonly testing device properties prior to reboot.""" 195 """Set standard readonly testing device properties prior to reboot."""
190 local_props = [ 196 local_props = [
191 'persist.sys.usb.config=adb', 197 'persist.sys.usb.config=adb',
192 'ro.monkey=1', 198 'ro.monkey=1',
193 'ro.test_harness=1', 199 'ro.test_harness=1',
194 'ro.audio.silent=1', 200 'ro.audio.silent=1',
195 'ro.setupwizard.mode=DISABLED', 201 'ro.setupwizard.mode=DISABLED',
196 ] 202 ]
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 # Kill if adb_reboot is already running. 240 # Kill if adb_reboot is already running.
235 device.KillAll('adb_reboot', blocking=True, timeout=2, quiet=True) 241 device.KillAll('adb_reboot', blocking=True, timeout=2, quiet=True)
236 # Push adb_reboot 242 # Push adb_reboot
237 logging.info(' Pushing adb_reboot ...') 243 logging.info(' Pushing adb_reboot ...')
238 adb_reboot = os.path.join(constants.DIR_SOURCE_ROOT, 244 adb_reboot = os.path.join(constants.DIR_SOURCE_ROOT,
239 'out/%s/adb_reboot' % target) 245 'out/%s/adb_reboot' % target)
240 device.PushChangedFiles([(adb_reboot, '/data/local/tmp/')]) 246 device.PushChangedFiles([(adb_reboot, '/data/local/tmp/')])
241 # Launch adb_reboot 247 # Launch adb_reboot
242 logging.info(' Launching adb_reboot ...') 248 logging.info(' Launching adb_reboot ...')
243 device.RunShellCommand( 249 device.RunShellCommand(
244 [device.GetDevicePieWrapper(), '/data/local/tmp/adb_reboot'], 250 ['/data/local/tmp/adb_reboot'],
245 check_return=True) 251 check_return=True)
246 252
247 253
248 def _LaunchHostHeartbeat(): 254 def _LaunchHostHeartbeat():
249 # Kill if existing host_heartbeat 255 # Kill if existing host_heartbeat
250 KillHostHeartbeat() 256 KillHostHeartbeat()
251 # Launch a new host_heartbeat 257 # Launch a new host_heartbeat
252 logging.info('Spawning host heartbeat...') 258 logging.info('Spawning host heartbeat...')
253 subprocess.Popen([os.path.join(constants.DIR_SOURCE_ROOT, 259 subprocess.Popen([os.path.join(constants.DIR_SOURCE_ROOT,
254 'build/android/host_heartbeat.py')]) 260 'build/android/host_heartbeat.py')])
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 help='disable Java property asserts and JNI checking') 307 help='disable Java property asserts and JNI checking')
302 parser.add_argument('-t', '--target', default='Debug', 308 parser.add_argument('-t', '--target', default='Debug',
303 help='the build target (default: %(default)s)') 309 help='the build target (default: %(default)s)')
304 parser.add_argument('-r', '--auto-reconnect', action='store_true', 310 parser.add_argument('-r', '--auto-reconnect', action='store_true',
305 help='push binary which will reboot the device on adb' 311 help='push binary which will reboot the device on adb'
306 ' disconnections') 312 ' disconnections')
307 parser.add_argument('--adb-key-files', type=str, nargs='+', 313 parser.add_argument('--adb-key-files', type=str, nargs='+',
308 help='list of adb keys to push to device') 314 help='list of adb keys to push to device')
309 parser.add_argument('-v', '--verbose', action='count', default=1, 315 parser.add_argument('-v', '--verbose', action='count', default=1,
310 help='Log more information.') 316 help='Log more information.')
317 parser.add_argument('--max-battery-temp', type=int, metavar='NUM',
318 help='Wait for the battery to have this temp or lower.')
311 args = parser.parse_args() 319 args = parser.parse_args()
312 constants.SetBuildType(args.target) 320 constants.SetBuildType(args.target)
313 321
314 run_tests_helper.SetLogLevel(args.verbose) 322 run_tests_helper.SetLogLevel(args.verbose)
315 323
316 return ProvisionDevices(args) 324 return ProvisionDevices(args)
317 325
318 326
319 if __name__ == '__main__': 327 if __name__ == '__main__':
320 sys.exit(main()) 328 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/gyp/write_ordered_libraries.py ('k') | build/android/pylib/base/base_setup.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698