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 | 8 |
9 import argparse | 9 import argparse |
10 import json | 10 import json |
11 import logging | 11 import logging |
12 import os | 12 import os |
13 import psutil | 13 import psutil |
14 import re | 14 import re |
15 import signal | 15 import signal |
16 import sys | 16 import sys |
17 | 17 |
18 sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) | 18 sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) |
| 19 import devil_chromium |
19 from devil.android import battery_utils | 20 from devil.android import battery_utils |
20 from devil.android import device_blacklist | 21 from devil.android import device_blacklist |
21 from devil.android import device_errors | 22 from devil.android import device_errors |
22 from devil.android import device_list | 23 from devil.android import device_list |
23 from devil.android import device_utils | 24 from devil.android import device_utils |
24 from devil.android.sdk import adb_wrapper | 25 from devil.android.sdk import adb_wrapper |
25 from devil.utils import lsusb | 26 from devil.utils import lsusb |
26 from devil.utils import reset_usb | 27 from devil.utils import reset_usb |
27 from devil.utils import run_tests_helper | 28 from devil.utils import run_tests_helper |
28 from pylib import constants | 29 from pylib import constants |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 parser.add_argument('--json-output', | 304 parser.add_argument('--json-output', |
304 help='Output JSON information into a specified file.') | 305 help='Output JSON information into a specified file.') |
305 parser.add_argument('--blacklist-file', help='Device blacklist JSON file.') | 306 parser.add_argument('--blacklist-file', help='Device blacklist JSON file.') |
306 parser.add_argument('-v', '--verbose', action='count', default=1, | 307 parser.add_argument('-v', '--verbose', action='count', default=1, |
307 help='Log more information.') | 308 help='Log more information.') |
308 | 309 |
309 args = parser.parse_args() | 310 args = parser.parse_args() |
310 | 311 |
311 run_tests_helper.SetLogLevel(args.verbose) | 312 run_tests_helper.SetLogLevel(args.verbose) |
312 | 313 |
| 314 devil_chromium.Initialize() |
| 315 |
313 blacklist = (device_blacklist.Blacklist(args.blacklist_file) | 316 blacklist = (device_blacklist.Blacklist(args.blacklist_file) |
314 if args.blacklist_file | 317 if args.blacklist_file |
315 else None) | 318 else None) |
316 | 319 |
317 last_devices_path = os.path.join( | 320 last_devices_path = os.path.join( |
318 args.out_dir, device_list.LAST_DEVICES_FILENAME) | 321 args.out_dir, device_list.LAST_DEVICES_FILENAME) |
319 try: | 322 try: |
320 expected_devices = set( | 323 expected_devices = set( |
321 device_list.GetPersistentDeviceList(last_devices_path)) | 324 device_list.GetPersistentDeviceList(last_devices_path)) |
322 except IOError: | 325 except IOError: |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 live_devices = [status['serial'] for status in statuses | 388 live_devices = [status['serial'] for status in statuses |
386 if (status['adb_status'] == 'device' | 389 if (status['adb_status'] == 'device' |
387 and not _IsBlacklisted(status['serial'], blacklist))] | 390 and not _IsBlacklisted(status['serial'], blacklist))] |
388 | 391 |
389 # If all devices failed, or if there are no devices, it's an infra error. | 392 # If all devices failed, or if there are no devices, it's an infra error. |
390 return 0 if live_devices else constants.INFRA_EXIT_CODE | 393 return 0 if live_devices else constants.INFRA_EXIT_CODE |
391 | 394 |
392 | 395 |
393 if __name__ == '__main__': | 396 if __name__ == '__main__': |
394 sys.exit(main()) | 397 sys.exit(main()) |
OLD | NEW |