| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2016 The Chromium Authors. All rights reserved. | 2 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """A script to keep track of devices across builds and report state.""" | 6 """A script to keep track of devices across builds and report state.""" |
| 7 | 7 |
| 8 import argparse | 8 import argparse |
| 9 import json | 9 import json |
| 10 import logging | 10 import logging |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 help='If set, overwrites known devices files wiht new ' | 253 help='If set, overwrites known devices files wiht new ' |
| 254 'values.') | 254 'values.') |
| 255 | 255 |
| 256 def main(): | 256 def main(): |
| 257 parser = argparse.ArgumentParser() | 257 parser = argparse.ArgumentParser() |
| 258 AddArguments(parser) | 258 AddArguments(parser) |
| 259 args = parser.parse_args() | 259 args = parser.parse_args() |
| 260 | 260 |
| 261 run_tests_helper.SetLogLevel(args.verbose) | 261 run_tests_helper.SetLogLevel(args.verbose) |
| 262 | 262 |
| 263 | 263 devil_dynamic_config = devil_env.EmptyConfig() |
| 264 devil_dynamic_config = { | |
| 265 'config_type': 'BaseConfig', | |
| 266 'dependencies': {}, | |
| 267 } | |
| 268 | 264 |
| 269 if args.adb_path: | 265 if args.adb_path: |
| 270 devil_dynamic_config['dependencies'].update({ | 266 devil_dynamic_config['dependencies'].update( |
| 271 'adb': { | 267 devil_env.LocalConfigItem( |
| 272 'file_info': { | 268 'adb', devil_env.GetPlatform(), args.adb_path)) |
| 273 devil_env.GetPlatform(): { | |
| 274 'local_paths': [args.adb_path] | |
| 275 } | |
| 276 } | |
| 277 } | |
| 278 }) | |
| 279 devil_env.config.Initialize(configs=[devil_dynamic_config]) | 269 devil_env.config.Initialize(configs=[devil_dynamic_config]) |
| 280 | 270 |
| 281 blacklist = (device_blacklist.Blacklist(args.blacklist_file) | 271 blacklist = (device_blacklist.Blacklist(args.blacklist_file) |
| 282 if args.blacklist_file | 272 if args.blacklist_file |
| 283 else None) | 273 else None) |
| 284 | 274 |
| 285 expected_devices = GetExpectedDevices(args.known_devices_files) | 275 expected_devices = GetExpectedDevices(args.known_devices_files) |
| 286 usb_devices = set(lsusb.get_android_devices()) | 276 usb_devices = set(lsusb.get_android_devices()) |
| 287 devices = [device_utils.DeviceUtils(s) | 277 devices = [device_utils.DeviceUtils(s) |
| 288 for s in expected_devices.union(usb_devices)] | 278 for s in expected_devices.union(usb_devices)] |
| (...skipping 23 matching lines...) Expand all Loading... |
| 312 and not IsBlacklisted(status['serial'], blacklist))] | 302 and not IsBlacklisted(status['serial'], blacklist))] |
| 313 | 303 |
| 314 # If all devices failed, or if there are no devices, it's an infra error. | 304 # If all devices failed, or if there are no devices, it's an infra error. |
| 315 if not live_devices: | 305 if not live_devices: |
| 316 logging.error('No available devices.') | 306 logging.error('No available devices.') |
| 317 return 0 if live_devices else exit_codes.INFRA | 307 return 0 if live_devices else exit_codes.INFRA |
| 318 | 308 |
| 319 | 309 |
| 320 if __name__ == '__main__': | 310 if __name__ == '__main__': |
| 321 sys.exit(main()) | 311 sys.exit(main()) |
| OLD | NEW |