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 23 matching lines...) Expand all Loading... | |
34 """ | 34 """ |
35 | 35 |
36 device_adb = android_commands.AndroidCommands(serial) | 36 device_adb = android_commands.AndroidCommands(serial) |
37 | 37 |
38 # TODO(navabi): Replace AdbShellCmd with device_adb. | 38 # TODO(navabi): Replace AdbShellCmd with device_adb. |
39 device_type = device_adb.GetBuildProduct() | 39 device_type = device_adb.GetBuildProduct() |
40 device_build = device_adb.GetBuildId() | 40 device_build = device_adb.GetBuildId() |
41 device_build_type = device_adb.GetBuildType() | 41 device_build_type = device_adb.GetBuildType() |
42 device_product_name = device_adb.GetProductName() | 42 device_product_name = device_adb.GetProductName() |
43 | 43 |
44 setup_wizard_disabled = device_adb.GetSetupWizardStatus() == 'DISABLED' | |
mkosiba (inactive)
2013/08/30 13:13:33
if you've taken the assert out in GetSetupWizardSt
navabi
2013/08/30 15:53:10
That would work too. But we would still be checkin
| |
45 battery = device_adb.GetBatteryInfo() | 44 battery = device_adb.GetBatteryInfo() |
46 install_output = GetCmdOutput( | 45 install_output = GetCmdOutput( |
47 ['%s/build/android/adb_install_apk.py' % constants.DIR_SOURCE_ROOT, '--apk', | 46 ['%s/build/android/adb_install_apk.py' % constants.DIR_SOURCE_ROOT, '--apk', |
48 '%s/build/android/CheckInstallApk-debug.apk' % constants.DIR_SOURCE_ROOT]) | 47 '%s/build/android/CheckInstallApk-debug.apk' % constants.DIR_SOURCE_ROOT]) |
49 | 48 |
50 def _GetData(re_expression, line, lambda_function=lambda x:x): | 49 def _GetData(re_expression, line, lambda_function=lambda x:x): |
51 if not line: | 50 if not line: |
52 return 'Unknown' | 51 return 'Unknown' |
53 found = re.findall(re_expression, line) | 52 found = re.findall(re_expression, line) |
54 if found and len(found): | 53 if found and len(found): |
(...skipping 14 matching lines...) Expand all Loading... | |
69 ' Battery: %s%%' % battery_level, | 68 ' Battery: %s%%' % battery_level, |
70 ' Battery temp: %s' % battery_temp, | 69 ' Battery temp: %s' % battery_temp, |
71 ' IMEI slice: %s' % imei_slice, | 70 ' IMEI slice: %s' % imei_slice, |
72 ' Wifi IP: %s' % device_adb.GetWifiIP(), | 71 ' Wifi IP: %s' % device_adb.GetWifiIP(), |
73 ' Install Speed: %s KB/s' % install_speed, | 72 ' Install Speed: %s KB/s' % install_speed, |
74 ''] | 73 ''] |
75 | 74 |
76 errors = [] | 75 errors = [] |
77 if battery_level < 15: | 76 if battery_level < 15: |
78 errors += ['Device critically low in battery. Turning off device.'] | 77 errors += ['Device critically low in battery. Turning off device.'] |
79 if (not setup_wizard_disabled and device_build_type != 'user' and | 78 if not options.no_provisioning_check: |
80 not options.no_provisioning_check): | 79 setup_wizard_disabled = device_adb.GetSetupWizardStatus() == 'DISABLED' |
81 errors += ['Setup wizard not disabled. Was it provisioned correctly?'] | 80 if not setup_wizard_disabled and device_build_type != 'user': |
81 errors += ['Setup wizard not disabled. Was it provisioned correctly?'] | |
82 if device_product_name == 'mantaray' and ac_power != 'true': | 82 if device_product_name == 'mantaray' and ac_power != 'true': |
83 errors += ['Mantaray device not connected to AC power.'] | 83 errors += ['Mantaray device not connected to AC power.'] |
84 # TODO(navabi): Insert warning once we have a better handle of what install | 84 # TODO(navabi): Insert warning once we have a better handle of what install |
85 # speeds to expect. The following lines were causing too many alerts. | 85 # speeds to expect. The following lines were causing too many alerts. |
86 # if install_speed < 500: | 86 # if install_speed < 500: |
87 # errors += ['Device install speed too low. Do not use for testing.'] | 87 # errors += ['Device install speed too low. Do not use for testing.'] |
88 | 88 |
89 # Causing the device status check step fail for slow install speed or low | 89 # Causing the device status check step fail for slow install speed or low |
90 # battery currently is too disruptive to the bots (especially try bots). | 90 # battery currently is too disruptive to the bots (especially try bots). |
91 # Turn off devices with low battery and the step does not fail. | 91 # Turn off devices with low battery and the step does not fail. |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
251 # devices with critically low battery or install speed. Remove those devices | 251 # devices with critically low battery or install speed. Remove those devices |
252 # from testing, allowing build to continue with good devices. | 252 # from testing, allowing build to continue with good devices. |
253 return 1 | 253 return 1 |
254 | 254 |
255 if not devices: | 255 if not devices: |
256 return 1 | 256 return 1 |
257 | 257 |
258 | 258 |
259 if __name__ == '__main__': | 259 if __name__ == '__main__': |
260 sys.exit(main()) | 260 sys.exit(main()) |
OLD | NEW |