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

Unified Diff: build/android/provision_devices.py

Issue 333723003: Wait for perfbot devices to charge between runs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fail high when battery level can't be determined Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/buildbot/bb_device_status_check.py ('k') | build/android/pylib/android_commands.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/provision_devices.py
diff --git a/build/android/provision_devices.py b/build/android/provision_devices.py
index 8433e01d7bec58ee6b781346544b2782ec14ac3b..ea6d807d5c3b1e922770cbb4d65bccd5c6d4452c 100755
--- a/build/android/provision_devices.py
+++ b/build/android/provision_devices.py
@@ -147,11 +147,32 @@ def ProvisionDevices(options):
_ConfigureLocalProperties(device)
device_settings.ConfigureContentSettingsDict(
device, device_settings.DETERMINISTIC_DEVICE_SETTINGS)
- # TODO(tonyg): We eventually want network on. However, currently radios
- # can cause perfbots to drain faster than they charge.
if 'perf' in os.environ.get('BUILDBOT_BUILDERNAME', '').lower():
+ # TODO(tonyg): We eventually want network on. However, currently radios
+ # can cause perfbots to drain faster than they charge.
device_settings.ConfigureContentSettingsDict(
device, device_settings.NETWORK_DISABLED_SETTINGS)
+ # Some perf bots run benchmarks with USB charging disabled which leads
+ # to gradual draining of the battery. We must wait for a full charge
+ # before starting a run in order to keep the devices online.
+ try:
+ battery_info = device.old_interface.GetBatteryInfo()
+ except Exception as e:
+ battery_info = {}
+ logging.error('Unable to obtain battery info for %s, %s',
+ device_serial, e)
+
+ while int(battery_info.get('level', 100)) < 95:
+ if not device.old_interface.IsDeviceCharging():
+ if device.old_interface.CanControlUsbCharging():
+ device.old_interface.EnableUsbCharging()
+ else:
+ logging.error('Device is not charging')
+ break
+ logging.info('Waiting for device to charge. Current level=%s',
+ battery_info.get('level', 0))
+ time.sleep(60)
+ battery_info = device.old_interface.GetBatteryInfo()
device.old_interface.RunShellCommandWithSU('date -u %f' % time.time())
try:
device_utils.DeviceUtils.parallel(devices).Reboot(True)
« no previous file with comments | « build/android/buildbot/bb_device_status_check.py ('k') | build/android/pylib/android_commands.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698