Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Side by Side Diff: build/android/buildbot/bb_device_status_check.py

Issue 1577383002: [Android] Make the adb path configurable in three scripts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/adb_install_apk.py ('k') | build/android/provision_devices.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import devil_chromium
20 from devil import devil_env
20 from devil.android import battery_utils 21 from devil.android import battery_utils
21 from devil.android import device_blacklist 22 from devil.android import device_blacklist
22 from devil.android import device_errors 23 from devil.android import device_errors
23 from devil.android import device_list 24 from devil.android import device_list
24 from devil.android import device_utils 25 from devil.android import device_utils
25 from devil.android.sdk import adb_wrapper 26 from devil.android.sdk import adb_wrapper
26 from devil.constants import exit_codes 27 from devil.constants import exit_codes
27 from devil.utils import lsusb 28 from devil.utils import lsusb
28 from devil.utils import reset_usb 29 from devil.utils import reset_usb
29 from devil.utils import run_tests_helper 30 from devil.utils import run_tests_helper
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 def main(): 298 def main():
298 parser = argparse.ArgumentParser() 299 parser = argparse.ArgumentParser()
299 parser.add_argument('--out-dir', 300 parser.add_argument('--out-dir',
300 help='Directory where the device path is stored', 301 help='Directory where the device path is stored',
301 default=os.path.join(host_paths.DIR_SOURCE_ROOT, 'out')) 302 default=os.path.join(host_paths.DIR_SOURCE_ROOT, 'out'))
302 parser.add_argument('--restart-usb', action='store_true', 303 parser.add_argument('--restart-usb', action='store_true',
303 help='DEPRECATED. ' 304 help='DEPRECATED. '
304 'This script now always tries to reset USB.') 305 'This script now always tries to reset USB.')
305 parser.add_argument('--json-output', 306 parser.add_argument('--json-output',
306 help='Output JSON information into a specified file.') 307 help='Output JSON information into a specified file.')
308 parser.add_argument('--adb-path',
309 help='Absolute path to the adb binary to use.')
307 parser.add_argument('--blacklist-file', help='Device blacklist JSON file.') 310 parser.add_argument('--blacklist-file', help='Device blacklist JSON file.')
308 parser.add_argument('-v', '--verbose', action='count', default=1, 311 parser.add_argument('-v', '--verbose', action='count', default=1,
309 help='Log more information.') 312 help='Log more information.')
310 313
311 args = parser.parse_args() 314 args = parser.parse_args()
312 315
313 run_tests_helper.SetLogLevel(args.verbose) 316 run_tests_helper.SetLogLevel(args.verbose)
314 317
315 devil_chromium.Initialize() 318 devil_custom_deps = None
319 if args.adb_path:
320 devil_custom_deps = {
321 'adb': {
322 devil_env.GetPlatform(): [args.adb_path],
323 },
324 }
325
326 devil_chromium.Initialize(custom_deps=devil_custom_deps)
316 327
317 blacklist = (device_blacklist.Blacklist(args.blacklist_file) 328 blacklist = (device_blacklist.Blacklist(args.blacklist_file)
318 if args.blacklist_file 329 if args.blacklist_file
319 else None) 330 else None)
320 331
321 last_devices_path = os.path.join( 332 last_devices_path = os.path.join(
322 args.out_dir, device_list.LAST_DEVICES_FILENAME) 333 args.out_dir, device_list.LAST_DEVICES_FILENAME)
323 try: 334 try:
324 expected_devices = set( 335 expected_devices = set(
325 device_list.GetPersistentDeviceList(last_devices_path)) 336 device_list.GetPersistentDeviceList(last_devices_path))
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 live_devices = [status['serial'] for status in statuses 400 live_devices = [status['serial'] for status in statuses
390 if (status['adb_status'] == 'device' 401 if (status['adb_status'] == 'device'
391 and not _IsBlacklisted(status['serial'], blacklist))] 402 and not _IsBlacklisted(status['serial'], blacklist))]
392 403
393 # If all devices failed, or if there are no devices, it's an infra error. 404 # If all devices failed, or if there are no devices, it's an infra error.
394 return 0 if live_devices else exit_codes.INFRA 405 return 0 if live_devices else exit_codes.INFRA
395 406
396 407
397 if __name__ == '__main__': 408 if __name__ == '__main__':
398 sys.exit(main()) 409 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/adb_install_apk.py ('k') | build/android/provision_devices.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698