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

Unified Diff: build/android/buildbot/bb_device_status_check.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 | « no previous file | build/android/provision_devices.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/buildbot/bb_device_status_check.py
diff --git a/build/android/buildbot/bb_device_status_check.py b/build/android/buildbot/bb_device_status_check.py
index a3b83415b3c21b90a1c90898818cd95517540125..c5e2b7f1c319418587834af63fa4ca3705319a37 100755
--- a/build/android/buildbot/bb_device_status_check.py
+++ b/build/android/buildbot/bb_device_status_check.py
@@ -52,9 +52,9 @@ def DeviceInfo(serial, options):
device_product_name = device_adb.old_interface.GetProductName()
try:
- battery = device_adb.old_interface.GetBatteryInfo()
+ battery_info = device_adb.old_interface.GetBatteryInfo()
except Exception as e:
- battery = None
+ battery_info = {}
logging.error('Unable to obtain battery info for %s, %s', serial, e)
def _GetData(re_expression, line, lambda_function=lambda x:x):
@@ -65,21 +65,16 @@ def DeviceInfo(serial, options):
return lambda_function(found[0])
return 'Unknown'
- def _GetBatteryInfo(battery):
- if not battery:
- return 'No battery info.'
- battery_info = battery.split('\n')
- return battery_info[0] + '\n '.join(battery_info[1:])
-
- ac_power = _GetData('AC powered: (\w+)', battery)
- battery_level = _GetData('level: (\d+)', battery)
+ battery_level = int(battery_info.get('level', 100))
imei_slice = _GetData('Device ID = (\d+)',
device_adb.old_interface.GetSubscriberInfo(),
lambda x: x[-6:])
report = ['Device %s (%s)' % (serial, device_type),
' Build: %s (%s)' %
(device_build, device_adb.old_interface.GetBuildFingerprint()),
- ' %s' % _GetBatteryInfo(battery),
+ ' Current Battery Service state: ',
+ '\n'.join([' %s: %s' % (k, v)
+ for k, v in battery_info.iteritems()]),
' IMEI slice: %s' % imei_slice,
' Wifi IP: %s' % device_adb.old_interface.GetWifiIP(),
'']
@@ -92,7 +87,8 @@ def DeviceInfo(serial, options):
device_adb.old_interface.GetSetupWizardStatus() == 'DISABLED')
if not setup_wizard_disabled and device_build_type != 'user':
errors += ['Setup wizard not disabled. Was it provisioned correctly?']
- if device_product_name == 'mantaray' and ac_power != 'true':
+ if (device_product_name == 'mantaray' and
+ battery_info.get('AC powered', None) != 'true'):
errors += ['Mantaray device not connected to AC power.']
# Turn off devices with low battery.
« no previous file with comments | « no previous file | build/android/provision_devices.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698