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 6d736a146baa7a26e398b7f81ec526785a4deff5..93de67db2fd8afaa1342d4694a9652cef7241134 100755 |
--- a/build/android/buildbot/bb_device_status_check.py |
+++ b/build/android/buildbot/bb_device_status_check.py |
@@ -31,7 +31,6 @@ from pylib import android_commands |
from pylib import constants |
from pylib.cmd_helper import GetCmdOutput |
from pylib.device import device_blacklist |
-from pylib.device import device_errors |
from pylib.device import device_list |
from pylib.device import device_utils |
@@ -83,7 +82,7 @@ def DeviceInfo(serial, options): |
errors = [] |
dev_good = True |
if battery_level < 15: |
- errors += ['Device critically low in battery. Turning off device.'] |
+ errors += ['Device critically low in battery. Will add to blacklist.'] |
dev_good = False |
if not options.no_provisioning_check: |
setup_wizard_disabled = ( |
@@ -94,16 +93,13 @@ def DeviceInfo(serial, options): |
battery_info.get('AC powered', None) != 'true'): |
errors += ['Mantaray device not connected to AC power.'] |
- # Turn off devices with low battery. |
+ # If battery low, device will be blacklisted. Ensure that device is charging. |
if battery_level < 15: |
- try: |
- device_adb.EnableRoot() |
- except device_errors.CommandFailedError as e: |
- # Attempt shutdown anyway. |
- # TODO(jbudorick) Handle this exception appropriately after interface |
- # conversions are finished. |
- logging.error(str(e)) |
- device_adb.old_interface.Shutdown() |
navabi
2014/10/23 21:13:41
we are no longer trying to turn the device off. In
jbudorick
2014/10/23 21:36:58
sgtm
|
+ if not device_adb.old_interface.IsDeviceCharging(): |
jbudorick
2014/10/23 21:36:58
nit: Can't we do this in the first if battery_leve
navabi
2014/10/23 21:57:37
Done.
|
+ if device_adb.old_interface.CanControlUsbCharging(): |
+ device_adb.old_interface.EnableUsbCharging() |
+ else: |
+ logging.error('Device %s is not charging' % serial) |
full_report = '\n'.join(report) |
return device_type, device_build, battery_level, full_report, errors, dev_good |
@@ -377,10 +373,15 @@ def main(): |
'unique_builds': unique_builds, |
})) |
- if False in fail_step_lst: |
- # TODO(navabi): Build fails on device status check step if there exists any |
- # devices with critically low battery. Remove those devices from testing, |
- # allowing build to continue with good devices. |
+ index = 0 |
+ num_failed_devs = 0 |
+ for fail_status in fail_step_lst: |
jbudorick
2014/10/23 21:36:58
nit: you could get rid of index with something lik
navabi
2014/10/23 21:57:37
Done. (i used zip instead of itertools.izip)
|
+ if not fail_status: |
+ device_blacklist.ExtendBlacklist([str(devices[index])]) |
+ num_failed_devs += 1 |
+ index += 1 |
+ |
+ if num_failed_devs == len(devices): |
return 2 |
if not devices: |