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

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

Issue 1314123005: [Android] Minor fixes for device_status_check. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 | no next file » | 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 argparse 8 import argparse
9 import json 9 import json
10 import logging 10 import logging
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 for d in should_reboot_device: 236 for d in should_reboot_device:
237 logging.debug(' %s', d) 237 logging.debug(' %s', d)
238 238
239 blacklist.Reset() 239 blacklist.Reset()
240 240
241 if should_restart_adb: 241 if should_restart_adb:
242 KillAllAdb() 242 KillAllAdb()
243 for serial in should_restart_usb: 243 for serial in should_restart_usb:
244 try: 244 try:
245 reset_usb.reset_android_usb(serial) 245 reset_usb.reset_android_usb(serial)
246 except device_errors.DeviceUnreachableError: 246 except (IOError, device_errors.DeviceUnreachableError):
247 logging.exception('Unable to reset USB for %s.', serial) 247 logging.exception('Unable to reset USB for %s.', serial)
248 if blacklist: 248 if blacklist:
249 blacklist.Extend([serial]) 249 blacklist.Extend([serial])
250 250
251 def blacklisting_recovery(device): 251 def blacklisting_recovery(device):
252 if blacklist and device.adb.GetDeviceSerial() in blacklist.Read(): 252 if blacklist and device.adb.GetDeviceSerial() in blacklist.Read():
253 logging.debug('%s is blacklisted, skipping recovery.', str(device)) 253 logging.debug('%s is blacklisted, skipping recovery.', str(device))
254 return 254 return
255 255
256 if device in should_reboot_device: 256 if device in should_reboot_device:
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 last_devices_path, 341 last_devices_path,
342 [status['serial'] for status in statuses]) 342 [status['serial'] for status in statuses])
343 343
344 # Write device info to file for buildbot info display. 344 # Write device info to file for buildbot info display.
345 if os.path.exists('/home/chrome-bot'): 345 if os.path.exists('/home/chrome-bot'):
346 with open('/home/chrome-bot/.adb_device_info', 'w') as f: 346 with open('/home/chrome-bot/.adb_device_info', 'w') as f:
347 for status in statuses: 347 for status in statuses:
348 try: 348 try:
349 if status['adb_status'] == 'device': 349 if status['adb_status'] == 'device':
350 f.write('{serial} {adb_status} {build_product} {build_id} ' 350 f.write('{serial} {adb_status} {build_product} {build_id} '
351 '{temperature:.1f}C {level}%'.format( 351 '{temperature:.1f}C {level}%\n'.format(
352 serial=status['serial'], 352 serial=status['serial'],
353 adb_status=status['adb_status'], 353 adb_status=status['adb_status'],
354 build_product=status['type'], 354 build_product=status['type'],
355 build_id=status['build'], 355 build_id=status['build'],
356 temperature=float(status['battery']['temperature']) / 10, 356 temperature=float(status['battery']['temperature']) / 10,
357 level=status['battery']['level'] 357 level=status['battery']['level']
358 )) 358 ))
359 else: 359 else:
360 f.write('{serial} {adb_status}'.format( 360 f.write('{serial} {adb_status}'.format(
361 serial=status['serial'], 361 serial=status['serial'],
(...skipping 10 matching lines...) Expand all
372 live_devices = [status['serial'] for status in statuses 372 live_devices = [status['serial'] for status in statuses
373 if (status['adb_status'] == 'device' 373 if (status['adb_status'] == 'device'
374 and status['serial'] not in blacklist.Read())] 374 and status['serial'] not in blacklist.Read())]
375 375
376 # If all devices failed, or if there are no devices, it's an infra error. 376 # If all devices failed, or if there are no devices, it's an infra error.
377 return 0 if live_devices else constants.INFRA_EXIT_CODE 377 return 0 if live_devices else constants.INFRA_EXIT_CODE
378 378
379 379
380 if __name__ == '__main__': 380 if __name__ == '__main__':
381 sys.exit(main()) 381 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698