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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 ' Battery: %s%%' % battery_level, | 63 ' Battery: %s%%' % battery_level, |
64 ' Battery temp: %s' % battery_temp, | 64 ' Battery temp: %s' % battery_temp, |
65 ' IMEI slice: %s' % AdbShellCmd('dumpsys iphonesubinfo ' | 65 ' IMEI slice: %s' % AdbShellCmd('dumpsys iphonesubinfo ' |
66 '| grep Device' | 66 '| grep Device' |
67 "| awk '{print $4}'")[-6:], | 67 "| awk '{print $4}'")[-6:], |
68 ' Wifi IP: %s' % AdbShellCmd('getprop dhcp.wlan0.ipaddress'), | 68 ' Wifi IP: %s' % AdbShellCmd('getprop dhcp.wlan0.ipaddress'), |
69 ' Install Speed: %s KB/s' % install_speed, | 69 ' Install Speed: %s KB/s' % install_speed, |
70 ''] | 70 ''] |
71 | 71 |
72 errors = [] | 72 errors = [] |
73 if battery_level < 5: | 73 if battery_level < 15: |
74 errors += ['Device critically low in battery. Do not use for testing.'] | 74 errors += ['Device critically low in battery. Do not use for testing.'] |
75 if not setup_wizard_disabled and device_build_type != 'user': | 75 if not setup_wizard_disabled and device_build_type != 'user': |
76 errors += ['Setup wizard not disabled. Was it provisioned correctly?'] | 76 errors += ['Setup wizard not disabled. Was it provisioned correctly?'] |
77 if device_product_name == 'mantaray' and ac_power != 'true': | 77 if device_product_name == 'mantaray' and ac_power != 'true': |
78 errors += ['Mantaray device not connected to AC power.'] | 78 errors += ['Mantaray device not connected to AC power.'] |
79 if install_speed < 800: | 79 # TODO(navabi): Insert warning once we have a better handle of what install |
80 errors += ['Device install speed too low. Do not use for testing.'] | 80 # speeds to expect. The following lines were causing too many alerts. |
| 81 # if install_speed < 500: |
| 82 # errors += ['Device install speed too low. Do not use for testing.'] |
81 | 83 |
82 # TODO(navabi): Determine if device status check step should fail on slow | 84 # TODO(navabi): Determine if device status check step should fail on slow |
83 # install speed. The original CL caused the step to fail but was reverted | 85 # install speed. The original CL caused the step to fail but was reverted |
84 # because it caused too many early failures. Determine if it was just flake. | 86 # because it caused too many early failures. Determine if it was just flake. |
85 # Also, do not fail on 'Unknown' caused by offline device, because other | 87 # Also, do not fail on 'Unknown' caused by offline device, because other |
86 # devices can still be used for tests. | 88 # devices can still be used for tests. |
87 fail_step = (battery_level == 'Unknown' or battery_level >= 5) | 89 fail_step = (battery_level == 'Unknown' or battery_level >= 15) |
88 return device_type, device_build, '\n'.join(report), errors, fail_step | 90 return device_type, device_build, '\n'.join(report), errors, fail_step |
89 | 91 |
90 | 92 |
91 def CheckForMissingDevices(options, adb_online_devs): | 93 def CheckForMissingDevices(options, adb_online_devs): |
92 """Uses file of previous online devices to detect broken phones. | 94 """Uses file of previous online devices to detect broken phones. |
93 | 95 |
94 Args: | 96 Args: |
95 options: out_dir parameter of options argument is used as the base | 97 options: out_dir parameter of options argument is used as the base |
96 directory to load and update the cache file. | 98 directory to load and update the cache file. |
97 adb_online_devs: A list of serial numbers of the currently visible | 99 adb_online_devs: A list of serial numbers of the currently visible |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 # devices with critically low battery or install speed. Remove those devices | 218 # devices with critically low battery or install speed. Remove those devices |
217 # from testing, allowing build to continue with good devices. | 219 # from testing, allowing build to continue with good devices. |
218 return 1 | 220 return 1 |
219 | 221 |
220 if not devices: | 222 if not devices: |
221 return 1 | 223 return 1 |
222 | 224 |
223 | 225 |
224 if __name__ == '__main__': | 226 if __name__ == '__main__': |
225 sys.exit(main()) | 227 sys.exit(main()) |
OLD | NEW |