OLD | NEW |
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 if 'Error' in battery: | 53 if 'Error' in battery: |
54 ac_power = 'Unknown' | 54 ac_power = 'Unknown' |
55 battery_level = 'Unknown' | 55 battery_level = 'Unknown' |
56 battery_temp = 'Unknown' | 56 battery_temp = 'Unknown' |
57 else: | 57 else: |
58 ac_power = re.findall('AC powered: (\w+)', battery)[0] | 58 ac_power = re.findall('AC powered: (\w+)', battery)[0] |
59 battery_level = int(re.findall('level: (\d+)', battery)[0]) | 59 battery_level = int(re.findall('level: (\d+)', battery)[0]) |
60 battery_temp = float(re.findall('temperature: (\d+)', battery)[0]) / 10 | 60 battery_temp = float(re.findall('temperature: (\d+)', battery)[0]) / 10 |
61 sub_info = device_adb.GetSubscriberInfo() | 61 sub_info = device_adb.GetSubscriberInfo() |
62 imei_slice = '' | 62 imei_slice = '' |
63 if sub_info and len(sub_info): | 63 device_id = re.findall('Device ID = (\d+)', sub_info) |
64 imei_slice = re.findall('Device ID = (\d+)', sub_info)[0][-6:] | 64 if device_id and len(device_id): |
| 65 imei_slice = device_id[0][-6:] |
65 report = ['Device %s (%s)' % (serial, device_type), | 66 report = ['Device %s (%s)' % (serial, device_type), |
66 ' Build: %s (%s)' % | 67 ' Build: %s (%s)' % |
67 (device_build, device_adb.GetBuildFingerprint()), | 68 (device_build, device_adb.GetBuildFingerprint()), |
68 ' Battery: %s%%' % battery_level, | 69 ' Battery: %s%%' % battery_level, |
69 ' Battery temp: %s' % battery_temp, | 70 ' Battery temp: %s' % battery_temp, |
70 ' IMEI slice: %s' % imei_slice, | 71 ' IMEI slice: %s' % imei_slice, |
71 ' Wifi IP: %s' % device_adb.GetWifiIP(), | 72 ' Wifi IP: %s' % device_adb.GetWifiIP(), |
72 ' Install Speed: %s KB/s' % install_speed, | 73 ' Install Speed: %s KB/s' % install_speed, |
73 ''] | 74 ''] |
74 | 75 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 # devices with critically low battery or install speed. Remove those devices | 241 # devices with critically low battery or install speed. Remove those devices |
241 # from testing, allowing build to continue with good devices. | 242 # from testing, allowing build to continue with good devices. |
242 return 1 | 243 return 1 |
243 | 244 |
244 if not devices: | 245 if not devices: |
245 return 1 | 246 return 1 |
246 | 247 |
247 | 248 |
248 if __name__ == '__main__': | 249 if __name__ == '__main__': |
249 sys.exit(main()) | 250 sys.exit(main()) |
OLD | NEW |