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

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

Issue 204353007: [Android] Extract device blacklisting into its own module. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 8 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 | « no previous file | build/android/pylib/android_commands.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 import logging 8 import logging
9 import optparse 9 import optparse
10 import os 10 import os
(...skipping 11 matching lines...) Expand all
22 22
23 sys.path.append(os.path.join(os.path.dirname(__file__), 23 sys.path.append(os.path.join(os.path.dirname(__file__),
24 os.pardir, os.pardir, 'util', 'lib', 24 os.pardir, os.pardir, 'util', 'lib',
25 'common')) 25 'common'))
26 import perf_tests_results_helper # pylint: disable=F0401 26 import perf_tests_results_helper # pylint: disable=F0401
27 27
28 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) 28 sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
29 from pylib import android_commands 29 from pylib import android_commands
30 from pylib import constants 30 from pylib import constants
31 from pylib.cmd_helper import GetCmdOutput 31 from pylib.cmd_helper import GetCmdOutput
32 32 from pylib.device import device_blacklist
33 33
34 def DeviceInfo(serial, options): 34 def DeviceInfo(serial, options):
35 """Gathers info on a device via various adb calls. 35 """Gathers info on a device via various adb calls.
36 36
37 Args: 37 Args:
38 serial: The serial of the attached device to construct info about. 38 serial: The serial of the attached device to construct info about.
39 39
40 Returns: 40 Returns:
41 Tuple of device type, build id, report as a string, error messages, and 41 Tuple of device type, build id, report as a string, error messages, and
42 boolean indicating whether or not device can be used for testing. 42 boolean indicating whether or not device can be used for testing.
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 parser.add_option('--no-provisioning-check', action='store_true', 268 parser.add_option('--no-provisioning-check', action='store_true',
269 help='Will not check if devices are provisioned properly.') 269 help='Will not check if devices are provisioned properly.')
270 parser.add_option('--device-status-dashboard', action='store_true', 270 parser.add_option('--device-status-dashboard', action='store_true',
271 help='Output device status data for dashboard.') 271 help='Output device status data for dashboard.')
272 parser.add_option('--restart-usb', action='store_true', 272 parser.add_option('--restart-usb', action='store_true',
273 help='Restart USB ports before running device check.') 273 help='Restart USB ports before running device check.')
274 options, args = parser.parse_args() 274 options, args = parser.parse_args()
275 if args: 275 if args:
276 parser.error('Unknown options %s' % args) 276 parser.error('Unknown options %s' % args)
277 277
278 # Remove the last builds "bad devices" before checking device statuses. 278 # Remove the last build's "bad devices" before checking device statuses.
279 android_commands.ResetBadDevices() 279 device_blacklist.ResetBlacklist()
280 280
281 if options.restart_usb: 281 if options.restart_usb:
282 expected_devices = GetLastDevices(os.path.abspath(options.out_dir)) 282 expected_devices = GetLastDevices(os.path.abspath(options.out_dir))
283 devices = android_commands.GetAttachedDevices() 283 devices = android_commands.GetAttachedDevices()
284 # Only restart usb if devices are missing. 284 # Only restart usb if devices are missing.
285 if set(expected_devices) != set(devices): 285 if set(expected_devices) != set(devices):
286 KillAllAdb() 286 KillAllAdb()
287 retries = 5 287 retries = 5
288 usb_restarted = True 288 usb_restarted = True
289 if not RestartUsb(): 289 if not RestartUsb():
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 # devices with critically low battery. Remove those devices from testing, 350 # devices with critically low battery. Remove those devices from testing,
351 # allowing build to continue with good devices. 351 # allowing build to continue with good devices.
352 return 1 352 return 1
353 353
354 if not devices: 354 if not devices:
355 return 1 355 return 1
356 356
357 357
358 if __name__ == '__main__': 358 if __name__ == '__main__':
359 sys.exit(main()) 359 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/android_commands.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698