| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 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 """A class to keep track of devices across builds and report state.""" | 7 """A class to keep track of devices across builds and report state.""" |
| 8 import argparse | 8 import argparse |
| 9 import json | 9 import json |
| 10 import logging | 10 import logging |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 parser.add_argument('--json-output', | 288 parser.add_argument('--json-output', |
| 289 help='Output JSON information into a specified file.') | 289 help='Output JSON information into a specified file.') |
| 290 parser.add_argument('--blacklist-file', help='Device blacklist JSON file.') | 290 parser.add_argument('--blacklist-file', help='Device blacklist JSON file.') |
| 291 parser.add_argument('-v', '--verbose', action='count', default=1, | 291 parser.add_argument('-v', '--verbose', action='count', default=1, |
| 292 help='Log more information.') | 292 help='Log more information.') |
| 293 | 293 |
| 294 args = parser.parse_args() | 294 args = parser.parse_args() |
| 295 | 295 |
| 296 run_tests_helper.SetLogLevel(args.verbose) | 296 run_tests_helper.SetLogLevel(args.verbose) |
| 297 | 297 |
| 298 blacklist = (device_blacklist.Blacklist(args.blacklist_file) | 298 if args.blacklist_file: |
| 299 if args.blacklist_file | 299 blacklist = device_blacklist.Blacklist(args.blacklist_file) |
| 300 else None) | 300 else: |
| 301 # TODO(jbudorick): Remove this once bots pass the blacklist file. |
| 302 blacklist = device_blacklist.Blacklist(device_blacklist.BLACKLIST_JSON) |
| 301 | 303 |
| 302 last_devices_path = os.path.join( | 304 last_devices_path = os.path.join( |
| 303 args.out_dir, device_list.LAST_DEVICES_FILENAME) | 305 args.out_dir, device_list.LAST_DEVICES_FILENAME) |
| 304 try: | 306 try: |
| 305 expected_devices = set( | 307 expected_devices = set( |
| 306 device_list.GetPersistentDeviceList(last_devices_path)) | 308 device_list.GetPersistentDeviceList(last_devices_path)) |
| 307 except IOError: | 309 except IOError: |
| 308 expected_devices = set() | 310 expected_devices = set() |
| 309 | 311 |
| 310 usb_devices = set(lsusb.get_android_devices()) | 312 usb_devices = set(lsusb.get_android_devices()) |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 live_devices = [status['serial'] for status in statuses | 372 live_devices = [status['serial'] for status in statuses |
| 371 if (status['adb_status'] == 'device' | 373 if (status['adb_status'] == 'device' |
| 372 and status['serial'] not in blacklist.Read())] | 374 and status['serial'] not in blacklist.Read())] |
| 373 | 375 |
| 374 # If all devices failed, or if there are no devices, it's an infra error. | 376 # If all devices failed, or if there are no devices, it's an infra error. |
| 375 return 0 if live_devices else constants.INFRA_EXIT_CODE | 377 return 0 if live_devices else constants.INFRA_EXIT_CODE |
| 376 | 378 |
| 377 | 379 |
| 378 if __name__ == '__main__': | 380 if __name__ == '__main__': |
| 379 sys.exit(main()) | 381 sys.exit(main()) |
| OLD | NEW |