| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 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 19 matching lines...) Expand all Loading... |
| 30 def AdbShellCmd(cmd): | 30 def AdbShellCmd(cmd): |
| 31 return GetCmdOutput('adb -s %s shell %s' % (serial, cmd), | 31 return GetCmdOutput('adb -s %s shell %s' % (serial, cmd), |
| 32 shell=True).strip() | 32 shell=True).strip() |
| 33 | 33 |
| 34 device_type = AdbShellCmd('getprop ro.build.product') | 34 device_type = AdbShellCmd('getprop ro.build.product') |
| 35 device_build = AdbShellCmd('getprop ro.build.id') | 35 device_build = AdbShellCmd('getprop ro.build.id') |
| 36 | 36 |
| 37 setup_wizard_disabled = AdbShellCmd( | 37 setup_wizard_disabled = AdbShellCmd( |
| 38 'getprop ro.setupwizard.mode') == 'DISABLED' | 38 'getprop ro.setupwizard.mode') == 'DISABLED' |
| 39 battery = AdbShellCmd('dumpsys battery') | 39 battery = AdbShellCmd('dumpsys battery') |
| 40 battery_level = int(re.findall('level: (\d+)', battery)[0]) | 40 if 'Error' in battery: |
| 41 battery_temp = float(re.findall('temperature: (\d+)', battery)[0])/10 | 41 battery_level = 'Unknown' |
| 42 battery_temp = 'Unknown' |
| 43 else: |
| 44 battery_level = int(re.findall('level: (\d+)', battery)[0]) |
| 45 battery_temp = float(re.findall('temperature: (\d+)', battery)[0]) / 10 |
| 42 report = ['Device %s (%s)' % (serial, device_type), | 46 report = ['Device %s (%s)' % (serial, device_type), |
| 43 ' Build: %s (%s)' % (device_build, | 47 ' Build: %s (%s)' % (device_build, |
| 44 AdbShellCmd('getprop ro.build.fingerprint')), | 48 AdbShellCmd('getprop ro.build.fingerprint')), |
| 45 ' Battery: %s%%' % battery_level, | 49 ' Battery: %s%%' % battery_level, |
| 46 ' Battery temp: %s' % battery_temp, | 50 ' Battery temp: %s' % battery_temp, |
| 47 ' IMEI slice: %s' % AdbShellCmd('dumpsys iphonesubinfo ' | 51 ' IMEI slice: %s' % AdbShellCmd('dumpsys iphonesubinfo ' |
| 48 '| grep Device' | 52 '| grep Device' |
| 49 "| awk '{print $4}'")[-6:], | 53 "| awk '{print $4}'")[-6:], |
| 50 ' Wifi IP: %s' % AdbShellCmd('getprop dhcp.wlan0.ipaddress'), | 54 ' Wifi IP: %s' % AdbShellCmd('getprop dhcp.wlan0.ipaddress'), |
| 51 ''] | 55 ''] |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 for serial, device_errors in zip(devices, errors): | 182 for serial, device_errors in zip(devices, errors): |
| 179 full_errors.extend('%s: %s' % (serial, error) for error in device_errors) | 183 full_errors.extend('%s: %s' % (serial, error) for error in device_errors) |
| 180 if full_errors: | 184 if full_errors: |
| 181 buildbot_report.PrintWarning() | 185 buildbot_report.PrintWarning() |
| 182 print '\n'.join(full_errors) | 186 print '\n'.join(full_errors) |
| 183 | 187 |
| 184 CheckForMissingDevices(options, devices) | 188 CheckForMissingDevices(options, devices) |
| 185 | 189 |
| 186 if __name__ == '__main__': | 190 if __name__ == '__main__': |
| 187 sys.exit(main()) | 191 sys.exit(main()) |
| OLD | NEW |