| 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 12 matching lines...) Expand all Loading... |
| 23 sys.path.append(os.path.join(os.path.dirname(__file__), | 23 sys.path.append(os.path.join(os.path.dirname(__file__), |
| 24 os.pardir, os.pardir, 'util', 'lib', | 24 os.pardir, os.pardir, 'util', 'lib', |
| 25 'common')) | 25 'common')) |
| 26 import perf_tests_results_helper # pylint: disable=F0401 | 26 import perf_tests_results_helper # pylint: disable=F0401 |
| 27 | 27 |
| 28 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) | 28 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
| 29 from pylib import android_commands | 29 from pylib import android_commands |
| 30 from pylib import constants | 30 from pylib import constants |
| 31 from pylib.cmd_helper import GetCmdOutput | 31 from pylib.cmd_helper import GetCmdOutput |
| 32 from pylib.device import device_blacklist | 32 from pylib.device import device_blacklist |
| 33 from pylib.device import device_errors |
| 33 from pylib.device import device_utils | 34 from pylib.device import device_utils |
| 34 | 35 |
| 35 def DeviceInfo(serial, options): | 36 def DeviceInfo(serial, options): |
| 36 """Gathers info on a device via various adb calls. | 37 """Gathers info on a device via various adb calls. |
| 37 | 38 |
| 38 Args: | 39 Args: |
| 39 serial: The serial of the attached device to construct info about. | 40 serial: The serial of the attached device to construct info about. |
| 40 | 41 |
| 41 Returns: | 42 Returns: |
| 42 Tuple of device type, build id, report as a string, error messages, and | 43 Tuple of device type, build id, report as a string, error messages, and |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 if not options.no_provisioning_check: | 83 if not options.no_provisioning_check: |
| 83 setup_wizard_disabled = ( | 84 setup_wizard_disabled = ( |
| 84 device_adb.old_interface.GetSetupWizardStatus() == 'DISABLED') | 85 device_adb.old_interface.GetSetupWizardStatus() == 'DISABLED') |
| 85 if not setup_wizard_disabled and device_build_type != 'user': | 86 if not setup_wizard_disabled and device_build_type != 'user': |
| 86 errors += ['Setup wizard not disabled. Was it provisioned correctly?'] | 87 errors += ['Setup wizard not disabled. Was it provisioned correctly?'] |
| 87 if device_product_name == 'mantaray' and ac_power != 'true': | 88 if device_product_name == 'mantaray' and ac_power != 'true': |
| 88 errors += ['Mantaray device not connected to AC power.'] | 89 errors += ['Mantaray device not connected to AC power.'] |
| 89 | 90 |
| 90 # Turn off devices with low battery. | 91 # Turn off devices with low battery. |
| 91 if battery_level < 15: | 92 if battery_level < 15: |
| 92 device_adb.old_interface.EnableAdbRoot() | 93 try: |
| 94 device_adb.EnableRoot() |
| 95 except device_errors.CommandFailedError: |
| 96 # Attempt shutdown anyway. |
| 97 pass |
| 93 device_adb.old_interface.Shutdown() | 98 device_adb.old_interface.Shutdown() |
| 94 full_report = '\n'.join(report) | 99 full_report = '\n'.join(report) |
| 95 return device_type, device_build, battery_level, full_report, errors, True | 100 return device_type, device_build, battery_level, full_report, errors, True |
| 96 | 101 |
| 97 | 102 |
| 98 def GetLastDevices(out_dir): | 103 def GetLastDevices(out_dir): |
| 99 """Returns a list of devices that have been seen on the bot. | 104 """Returns a list of devices that have been seen on the bot. |
| 100 | 105 |
| 101 Args: | 106 Args: |
| 102 options: out_dir parameter of options argument is used as the base | 107 options: out_dir parameter of options argument is used as the base |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 # devices with critically low battery. Remove those devices from testing, | 351 # devices with critically low battery. Remove those devices from testing, |
| 347 # allowing build to continue with good devices. | 352 # allowing build to continue with good devices. |
| 348 return 1 | 353 return 1 |
| 349 | 354 |
| 350 if not devices: | 355 if not devices: |
| 351 return 1 | 356 return 1 |
| 352 | 357 |
| 353 | 358 |
| 354 if __name__ == '__main__': | 359 if __name__ == '__main__': |
| 355 sys.exit(main()) | 360 sys.exit(main()) |
| OLD | NEW |