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

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

Issue 1316413003: [Android] Add a configurable environment for devil/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 2 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/PRESUBMIT.py ('k') | build/android/devil/android/apk_helper.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 from devil import devil_env
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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 parser.add_argument('--json-output', 281 parser.add_argument('--json-output',
281 help='Output JSON information into a specified file.') 282 help='Output JSON information into a specified file.')
282 parser.add_argument('--blacklist-file', help='Device blacklist JSON file.') 283 parser.add_argument('--blacklist-file', help='Device blacklist JSON file.')
283 parser.add_argument('-v', '--verbose', action='count', default=1, 284 parser.add_argument('-v', '--verbose', action='count', default=1,
284 help='Log more information.') 285 help='Log more information.')
285 286
286 args = parser.parse_args() 287 args = parser.parse_args()
287 288
288 run_tests_helper.SetLogLevel(args.verbose) 289 run_tests_helper.SetLogLevel(args.verbose)
289 290
291 devil_env.config.Initialize()
292
290 blacklist = (device_blacklist.Blacklist(args.blacklist_file) 293 blacklist = (device_blacklist.Blacklist(args.blacklist_file)
291 if args.blacklist_file 294 if args.blacklist_file
292 else None) 295 else None)
293 296
294 last_devices_path = os.path.join( 297 last_devices_path = os.path.join(
295 args.out_dir, device_list.LAST_DEVICES_FILENAME) 298 args.out_dir, device_list.LAST_DEVICES_FILENAME)
296 try: 299 try:
297 expected_devices = set( 300 expected_devices = set(
298 device_list.GetPersistentDeviceList(last_devices_path)) 301 device_list.GetPersistentDeviceList(last_devices_path))
299 except IOError: 302 except IOError:
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 live_devices = [status['serial'] for status in statuses 365 live_devices = [status['serial'] for status in statuses
363 if (status['adb_status'] == 'device' 366 if (status['adb_status'] == 'device'
364 and not _IsBlacklisted(status['serial'], blacklist))] 367 and not _IsBlacklisted(status['serial'], blacklist))]
365 368
366 # If all devices failed, or if there are no devices, it's an infra error. 369 # If all devices failed, or if there are no devices, it's an infra error.
367 return 0 if live_devices else constants.INFRA_EXIT_CODE 370 return 0 if live_devices else constants.INFRA_EXIT_CODE
368 371
369 372
370 if __name__ == '__main__': 373 if __name__ == '__main__':
371 sys.exit(main()) 374 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/PRESUBMIT.py ('k') | build/android/devil/android/apk_helper.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698