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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 return 'Unknown' | 64 return 'Unknown' |
65 | 65 |
66 ac_power = _GetData('AC powered: (\w+)', battery) | 66 ac_power = _GetData('AC powered: (\w+)', battery) |
67 battery_level = _GetData('level: (\d+)', battery) | 67 battery_level = _GetData('level: (\d+)', battery) |
68 imei_slice = _GetData('Device ID = (\d+)', | 68 imei_slice = _GetData('Device ID = (\d+)', |
69 device_adb.old_interface.GetSubscriberInfo(), | 69 device_adb.old_interface.GetSubscriberInfo(), |
70 lambda x: x[-6:]) | 70 lambda x: x[-6:]) |
71 report = ['Device %s (%s)' % (serial, device_type), | 71 report = ['Device %s (%s)' % (serial, device_type), |
72 ' Build: %s (%s)' % | 72 ' Build: %s (%s)' % |
73 (device_build, device_adb.old_interface.GetBuildFingerprint()), | 73 (device_build, device_adb.old_interface.GetBuildFingerprint()), |
74 ' %s' % '\n '.join(battery.split('\n')), | 74 ' %s' % '\n '.join(battery.split('\n')) if battery else '', |
luqui
2014/05/13 22:25:43
This inline if is a bit dense and will be tough fo
luqui
2014/05/13 22:26:38
Better yet, a function "indent", to state your int
navabi
2014/05/13 22:40:30
Done. I didn't think we needed an 'indent' functio
| |
75 ' IMEI slice: %s' % imei_slice, | 75 ' IMEI slice: %s' % imei_slice, |
76 ' Wifi IP: %s' % device_adb.old_interface.GetWifiIP(), | 76 ' Wifi IP: %s' % device_adb.old_interface.GetWifiIP(), |
77 ''] | 77 ''] |
78 | 78 |
79 errors = [] | 79 errors = [] |
80 if battery_level < 15: | 80 if battery_level < 15: |
81 errors += ['Device critically low in battery. Turning off device.'] | 81 errors += ['Device critically low in battery. Turning off device.'] |
82 if not options.no_provisioning_check: | 82 if not options.no_provisioning_check: |
83 setup_wizard_disabled = ( | 83 setup_wizard_disabled = ( |
84 device_adb.old_interface.GetSetupWizardStatus() == 'DISABLED') | 84 device_adb.old_interface.GetSetupWizardStatus() == 'DISABLED') |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
346 # devices with critically low battery. Remove those devices from testing, | 346 # devices with critically low battery. Remove those devices from testing, |
347 # allowing build to continue with good devices. | 347 # allowing build to continue with good devices. |
348 return 1 | 348 return 1 |
349 | 349 |
350 if not devices: | 350 if not devices: |
351 return 1 | 351 return 1 |
352 | 352 |
353 | 353 |
354 if __name__ == '__main__': | 354 if __name__ == '__main__': |
355 sys.exit(main()) | 355 sys.exit(main()) |
OLD | NEW |