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

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

Issue 1129003003: [Android] Make device_status_check handle single-device failures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 json 8 import json
9 import logging 9 import logging
10 import optparse 10 import optparse
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 Args: 45 Args:
46 serial: The serial of the attached device to construct info about. 46 serial: The serial of the attached device to construct info about.
47 47
48 Returns: 48 Returns:
49 Tuple of device type, build id, report as a string, error messages, and 49 Tuple of device type, build id, report as a string, error messages, and
50 boolean indicating whether or not device can be used for testing. 50 boolean indicating whether or not device can be used for testing.
51 """ 51 """
52 device = device_utils.DeviceUtils(serial) 52 device = device_utils.DeviceUtils(serial)
53 battery = battery_utils.BatteryUtils(device) 53 battery = battery_utils.BatteryUtils(device)
54 54
55 battery_info = {} 55 build_product = ''
56 build_id = ''
56 battery_level = 100 57 battery_level = 100
57 errors = [] 58 errors = []
58 dev_good = True 59 dev_good = True
59 json_data = { 60 json_data = {}
60 'serial': serial,
61 'type': device.build_product,
62 'build': device.build_id,
63 'build_detail': device.GetProp('ro.build.fingerprint'),
64 'battery': {},
65 'imei_slice': 'Unknown',
66 'wifi_ip': device.GetProp('dhcp.wlan0.ipaddress'),
67 }
68 61
69 try: 62 try:
63 build_product = device.build_product
64 build_id = device.build_id
65
66 json_data = {
67 'serial': serial,
68 'type': build_product,
69 'build': build_id,
70 'build_detail': device.GetProp('ro.build.fingerprint'),
71 'battery': {},
72 'imei_slice': 'Unknown',
73 'wifi_ip': device.GetProp('dhcp.wlan0.ipaddress'),
74 }
75
76 battery_info = {}
70 try: 77 try:
71 battery_info = battery.GetBatteryInfo(timeout=5) 78 battery_info = battery.GetBatteryInfo(timeout=5)
72 battery_level = int(battery_info.get('level', battery_level)) 79 battery_level = int(battery_info.get('level', battery_level))
73 json_data['battery'] = battery_info 80 json_data['battery'] = battery_info
74 except device_errors.CommandFailedError: 81 except device_errors.CommandFailedError:
75 logging.exception('Failed to get battery information for %s', serial) 82 logging.exception('Failed to get battery information for %s', serial)
76 83
77 try: 84 try:
78 for l in device.RunShellCommand(['dumpsys', 'iphonesubinfo'], 85 for l in device.RunShellCommand(['dumpsys', 'iphonesubinfo'],
79 check_return=True, timeout=5): 86 check_return=True, timeout=5):
(...skipping 16 matching lines...) Expand all
96 if (device.product_name == 'mantaray' and 103 if (device.product_name == 'mantaray' and
97 battery_info.get('AC powered', None) != 'true'): 104 battery_info.get('AC powered', None) != 'true'):
98 errors += ['Mantaray device not connected to AC power.'] 105 errors += ['Mantaray device not connected to AC power.']
99 except device_errors.CommandFailedError: 106 except device_errors.CommandFailedError:
100 logging.exception('Failure while getting device status.') 107 logging.exception('Failure while getting device status.')
101 dev_good = False 108 dev_good = False
102 except device_errors.CommandTimeoutError: 109 except device_errors.CommandTimeoutError:
103 logging.exception('Timeout while getting device status.') 110 logging.exception('Timeout while getting device status.')
104 dev_good = False 111 dev_good = False
105 112
106 return (device.build_product, device.build_id, battery_level, errors, 113 return (build_product, build_id, battery_level, errors, dev_good, json_data)
107 dev_good, json_data)
108 114
109 115
110 def CheckForMissingDevices(options, adb_online_devs): 116 def CheckForMissingDevices(options, adb_online_devs):
111 """Uses file of previous online devices to detect broken phones. 117 """Uses file of previous online devices to detect broken phones.
112 118
113 Args: 119 Args:
114 options: out_dir parameter of options argument is used as the base 120 options: out_dir parameter of options argument is used as the base
115 directory to load and update the cache file. 121 directory to load and update the cache file.
116 adb_online_devs: A list of serial numbers of the currently visible 122 adb_online_devs: A list of serial numbers of the currently visible
117 and online attached devices. 123 and online attached devices.
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 409
404 if num_failed_devs == len(devices): 410 if num_failed_devs == len(devices):
405 return 2 411 return 2
406 412
407 if not devices: 413 if not devices:
408 return 1 414 return 1
409 415
410 416
411 if __name__ == '__main__': 417 if __name__ == '__main__':
412 sys.exit(main()) 418 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