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

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

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 if options.disable_location: 171 if options.disable_location:
172 device_settings.ConfigureContentSettings( 172 device_settings.ConfigureContentSettings(
173 device, device_settings.DISABLE_LOCATION_SETTINGS) 173 device, device_settings.DISABLE_LOCATION_SETTINGS)
174 else: 174 else:
175 device_settings.ConfigureContentSettings( 175 device_settings.ConfigureContentSettings(
176 device, device_settings.ENABLE_LOCATION_SETTINGS) 176 device, device_settings.ENABLE_LOCATION_SETTINGS)
177 device_settings.SetLockScreenSettings(device) 177 device_settings.SetLockScreenSettings(device)
178 if options.disable_network: 178 if options.disable_network:
179 device_settings.ConfigureContentSettings( 179 device_settings.ConfigureContentSettings(
180 device, device_settings.NETWORK_DISABLED_SETTINGS) 180 device, device_settings.NETWORK_DISABLED_SETTINGS)
181 if options.min_battery_level is not None: 181 if options.wait_for_battery:
182 try: 182 try:
183 battery_info = device.old_interface.GetBatteryInfo() 183 battery_info = device.old_interface.GetBatteryInfo()
184 except Exception as e: 184 except Exception as e:
185 battery_info = {} 185 battery_info = {}
186 logging.error('Unable to obtain battery info for %s, %s', 186 logging.error('Unable to obtain battery info for %s, %s',
187 str(device), e) 187 str(device), e)
188 188
189 while int(battery_info.get('level', 100)) < options.min_battery_level: 189 while int(battery_info.get('level', 100)) < options.min_battery_level:
190 if not device.old_interface.IsDeviceCharging(): 190 if not device.old_interface.IsDeviceCharging():
191 if device.old_interface.CanControlUsbCharging(): 191 if device.old_interface.CanControlUsbCharging():
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 raise device_errors.NoDevicesError 234 raise device_errors.NoDevicesError
235 return 0 235 return 0
236 236
237 237
238 def main(): 238 def main():
239 custom_handler = logging.StreamHandler(sys.stdout) 239 custom_handler = logging.StreamHandler(sys.stdout)
240 custom_handler.setFormatter(run_tests_helper.CustomFormatter()) 240 custom_handler.setFormatter(run_tests_helper.CustomFormatter())
241 logging.getLogger().addHandler(custom_handler) 241 logging.getLogger().addHandler(custom_handler)
242 logging.getLogger().setLevel(logging.INFO) 242 logging.getLogger().setLevel(logging.INFO)
243 243
244 # TODO(perezju): This script used to rely on the builder name to determine
245 # the desired device configuration for perf bots. To safely phase this out,
246 # we now:
247 # - expose these configuration settings as command line options
248 # - set default values for these options based on the builder name, thus
249 # matching the previous behaviour of the script on all bots.
250 # - explicitly adding these options on the perf bots will also maintain the
251 # script behaviour, namely:
252 # --wait-for-battery --disable-network --disable-java-debug
253 # - after all perf-bot recipes are updated, we can remove the following
254 # builder-name-sniffing code and replace |is_perf| with |False|.
255 is_perf = 'perf' in os.environ.get('BUILDBOT_BUILDERNAME', '').lower()
256
244 # Recommended options on perf bots: 257 # Recommended options on perf bots:
245 # --disable-network 258 # --disable-network
246 # TODO(tonyg): We eventually want network on. However, currently radios 259 # TODO(tonyg): We eventually want network on. However, currently radios
247 # can cause perfbots to drain faster than they charge. 260 # can cause perfbots to drain faster than they charge.
248 # --min-battery-level 95 261 # --wait-for-battery
249 # Some perf bots run benchmarks with USB charging disabled which leads 262 # Some perf bots run benchmarks with USB charging disabled which leads
250 # to gradual draining of the battery. We must wait for a full charge 263 # to gradual draining of the battery. We must wait for a full charge
251 # before starting a run in order to keep the devices online. 264 # before starting a run in order to keep the devices online.
252 265
253 parser = argparse.ArgumentParser( 266 parser = argparse.ArgumentParser(
254 description='Provision Android devices with settings required for bots.') 267 description='Provision Android devices with settings required for bots.')
255 parser.add_argument('-d', '--device', metavar='SERIAL', 268 parser.add_argument('-d', '--device', metavar='SERIAL',
256 help='the serial number of the device to be provisioned' 269 help='the serial number of the device to be provisioned'
257 ' (the default is to provision all devices attached)') 270 ' (the default is to provision all devices attached)')
258 parser.add_argument('--skip-wipe', action='store_true', default=False, 271 parser.add_argument('--skip-wipe', action='store_true', default=False,
259 help="don't wipe device data during provisioning") 272 help="don't wipe device data during provisioning")
260 parser.add_argument('--reboot-timeout', metavar='SECS', type=int, 273 parser.add_argument('--reboot-timeout', metavar='SECS', type=int,
261 help='when wiping the device, max number of seconds to' 274 help='when wiping the device, max number of seconds to'
262 ' wait after each reboot ' 275 ' wait after each reboot '
263 '(default: %s)' % _DEFAULT_TIMEOUTS.HELP_TEXT) 276 '(default: %s)' % _DEFAULT_TIMEOUTS.HELP_TEXT)
264 parser.add_argument('--min-battery-level', type=int, metavar='NUM', 277 parser.add_argument('--wait-for-battery', action='store_true',
265 help='wait for the device to reach this minimum battery' 278 default=is_perf,
266 ' level before trying to continue') 279 help='wait for the battery on the devices to charge')
280 parser.add_argument('--min-battery-level', default=95, type=int,
281 metavar='NUM',
282 help='when waiting for battery, minimum battery level'
283 ' required to continue (default: %(default)s)')
267 parser.add_argument('--disable-location', action='store_true', 284 parser.add_argument('--disable-location', action='store_true',
268 help='disable Google location services on devices') 285 help='disable Google location services on devices')
269 parser.add_argument('--disable-network', action='store_true', 286 parser.add_argument('--disable-network', action='store_true',
287 default=is_perf,
270 help='disable network access on devices') 288 help='disable network access on devices')
271 parser.add_argument('--disable-java-debug', action='store_false', 289 parser.add_argument('--disable-java-debug', action='store_false',
272 dest='enable_java_debug', default=True, 290 dest='enable_java_debug', default=not is_perf,
273 help='disable Java property asserts and JNI checking') 291 help='disable Java property asserts and JNI checking')
274 parser.add_argument('-t', '--target', default='Debug', 292 parser.add_argument('-t', '--target', default='Debug',
275 help='the build target (default: %(default)s)') 293 help='the build target (default: %(default)s)')
276 parser.add_argument('-r', '--auto-reconnect', action='store_true', 294 parser.add_argument('-r', '--auto-reconnect', action='store_true',
277 help='push binary which will reboot the device on adb' 295 help='push binary which will reboot the device on adb'
278 ' disconnections') 296 ' disconnections')
279 args = parser.parse_args() 297 args = parser.parse_args()
280 constants.SetBuildType(args.target) 298 constants.SetBuildType(args.target)
281 299
282 return ProvisionDevices(args) 300 return ProvisionDevices(args)
283 301
284 302
285 if __name__ == '__main__': 303 if __name__ == '__main__':
286 sys.exit(main()) 304 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/findbugs_filter/findbugs_known_bugs.txt ('k') | build/android/pylib/base/base_test_result.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698