| 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 """Runs all types of tests from one unified interface.""" | 7 """Runs all types of tests from one unified interface.""" |
| 8 | 8 |
| 9 import argparse | 9 import argparse |
| 10 import collections | 10 import collections |
| (...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 | 888 |
| 889 def _GetAttachedDevices(blacklist_file, test_device): | 889 def _GetAttachedDevices(blacklist_file, test_device): |
| 890 """Get all attached devices. | 890 """Get all attached devices. |
| 891 | 891 |
| 892 Args: | 892 Args: |
| 893 test_device: Name of a specific device to use. | 893 test_device: Name of a specific device to use. |
| 894 | 894 |
| 895 Returns: | 895 Returns: |
| 896 A list of attached devices. | 896 A list of attached devices. |
| 897 """ | 897 """ |
| 898 if not blacklist_file: | 898 blacklist = (device_blacklist.Blacklist(blacklist_file) |
| 899 # TODO(jbudorick): Remove this once bots pass the blacklist file. | 899 if blacklist_file |
| 900 blacklist_file = device_blacklist.BLACKLIST_JSON | 900 else None) |
| 901 logging.warning('Using default device blacklist %s', | |
| 902 device_blacklist.BLACKLIST_JSON) | |
| 903 | 901 |
| 904 blacklist = device_blacklist.Blacklist(blacklist_file) | |
| 905 attached_devices = device_utils.DeviceUtils.HealthyDevices(blacklist) | 902 attached_devices = device_utils.DeviceUtils.HealthyDevices(blacklist) |
| 906 if test_device: | 903 if test_device: |
| 907 test_device = [d for d in attached_devices if d == test_device] | 904 test_device = [d for d in attached_devices if d == test_device] |
| 908 if not test_device: | 905 if not test_device: |
| 909 raise device_errors.DeviceUnreachableError( | 906 raise device_errors.DeviceUnreachableError( |
| 910 'Did not find device %s among attached device. Attached devices: %s' | 907 'Did not find device %s among attached device. Attached devices: %s' |
| 911 % (test_device, ', '.join(attached_devices))) | 908 % (test_device, ', '.join(attached_devices))) |
| 912 return test_device | 909 return test_device |
| 913 | 910 |
| 914 else: | 911 else: |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 if e.is_infra_error: | 1063 if e.is_infra_error: |
| 1067 return constants.INFRA_EXIT_CODE | 1064 return constants.INFRA_EXIT_CODE |
| 1068 return constants.ERROR_EXIT_CODE | 1065 return constants.ERROR_EXIT_CODE |
| 1069 except: # pylint: disable=W0702 | 1066 except: # pylint: disable=W0702 |
| 1070 logging.exception('Unrecognized error occurred.') | 1067 logging.exception('Unrecognized error occurred.') |
| 1071 return constants.ERROR_EXIT_CODE | 1068 return constants.ERROR_EXIT_CODE |
| 1072 | 1069 |
| 1073 | 1070 |
| 1074 if __name__ == '__main__': | 1071 if __name__ == '__main__': |
| 1075 sys.exit(main()) | 1072 sys.exit(main()) |
| OLD | NEW |