| 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 74d50ae00aa08334e915f4a0537450db49f07500..3a2e990178a846064961ede8986035b88d9e16b9 100755
|
| --- a/build/android/buildbot/bb_device_status_check.py
|
| +++ b/build/android/buildbot/bb_device_status_check.py
|
| @@ -55,6 +55,10 @@ def KillAllAdb():
|
| pass
|
|
|
|
|
| +def _IsBlacklisted(serial, blacklist):
|
| + return blacklist and serial in blacklist.Read()
|
| +
|
| +
|
| def _BatteryStatus(device, blacklist):
|
| battery_info = {}
|
| try:
|
| @@ -138,7 +142,7 @@ def DeviceStatus(devices, blacklist):
|
| }
|
|
|
| if adb_status == 'device':
|
| - if not serial in blacklist.Read():
|
| + if not _IsBlacklisted(serial, blacklist):
|
| try:
|
| build_product = device.build_product
|
| build_id = device.build_id
|
| @@ -180,7 +184,7 @@ def DeviceStatus(devices, blacklist):
|
| elif blacklist:
|
| blacklist.Extend([serial])
|
|
|
| - device_status['blacklisted'] = serial in blacklist.Read()
|
| + device_status['blacklisted'] = _IsBlacklisted(serial, blacklist)
|
|
|
| return device_status
|
|
|
| @@ -223,7 +227,8 @@ def RecoverDevices(devices, blacklist):
|
| for d in should_reboot_device:
|
| logging.debug(' %s', d)
|
|
|
| - blacklist.Reset()
|
| + if blacklist:
|
| + blacklist.Reset()
|
|
|
| if should_restart_adb:
|
| KillAllAdb()
|
| @@ -236,7 +241,7 @@ def RecoverDevices(devices, blacklist):
|
| blacklist.Extend([serial])
|
|
|
| def blacklisting_recovery(device):
|
| - if blacklist and device.adb.GetDeviceSerial() in blacklist.Read():
|
| + if _IsBlacklisted(device.adb.GetDeviceSerial(), blacklist):
|
| logging.debug('%s is blacklisted, skipping recovery.', str(device))
|
| return
|
|
|
| @@ -282,11 +287,9 @@ def main():
|
|
|
| run_tests_helper.SetLogLevel(args.verbose)
|
|
|
| - if args.blacklist_file:
|
| - blacklist = device_blacklist.Blacklist(args.blacklist_file)
|
| - else:
|
| - # TODO(jbudorick): Remove this once bots pass the blacklist file.
|
| - blacklist = device_blacklist.Blacklist(device_blacklist.BLACKLIST_JSON)
|
| + blacklist = (device_blacklist.Blacklist(args.blacklist_file)
|
| + if args.blacklist_file
|
| + else None)
|
|
|
| last_devices_path = os.path.join(
|
| args.out_dir, device_list.LAST_DEVICES_FILENAME)
|
| @@ -358,7 +361,7 @@ def main():
|
|
|
| live_devices = [status['serial'] for status in statuses
|
| if (status['adb_status'] == 'device'
|
| - and status['serial'] not in blacklist.Read())]
|
| + and not _IsBlacklisted(status['serial'], blacklist))]
|
|
|
| # If all devices failed, or if there are no devices, it's an infra error.
|
| return 0 if live_devices else constants.INFRA_EXIT_CODE
|
|
|