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