Chromium Code Reviews| 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 21 matching lines...) Expand all Loading... | |
| 32 return GetCmdOutput('adb -s %s shell %s' % (serial, cmd), | 32 return GetCmdOutput('adb -s %s shell %s' % (serial, cmd), |
| 33 shell=True).strip() | 33 shell=True).strip() |
| 34 | 34 |
| 35 device_type = AdbShellCmd('getprop ro.build.product') | 35 device_type = AdbShellCmd('getprop ro.build.product') |
| 36 device_build = AdbShellCmd('getprop ro.build.id') | 36 device_build = AdbShellCmd('getprop ro.build.id') |
| 37 device_product_name = AdbShellCmd('getprop ro.product.name') | 37 device_product_name = AdbShellCmd('getprop ro.product.name') |
| 38 | 38 |
| 39 setup_wizard_disabled = AdbShellCmd( | 39 setup_wizard_disabled = AdbShellCmd( |
| 40 'getprop ro.setupwizard.mode') == 'DISABLED' | 40 'getprop ro.setupwizard.mode') == 'DISABLED' |
| 41 battery = AdbShellCmd('dumpsys battery') | 41 battery = AdbShellCmd('dumpsys battery') |
| 42 install_output = GetCmdOutput(['build/android/adb_install_apk.py', '--apk', | 42 chrome_src = os.environ.get('CHROME_SRC') |
|
Siva Chandra
2013/06/04 23:51:03
how about pylib.constants.CHROME_DIR?
| |
| 43 'build/android/CheckInstallApk-debug.apk']) | 43 install_output = GetCmdOutput( |
| 44 ['%s/build/android/adb_install_apk.py' % chrome_src, '--apk', | |
| 45 '%s/build/android/CheckInstallApk-debug.apk' % chrome_src]) | |
| 44 install_speed_found = re.findall('(\d+) KB/s', install_output) | 46 install_speed_found = re.findall('(\d+) KB/s', install_output) |
| 45 if install_speed_found: | 47 if install_speed_found: |
| 46 install_speed = int(install_speed_found[0]) | 48 install_speed = int(install_speed_found[0]) |
| 47 else: | 49 else: |
| 48 install_speed = 'Unknown' | 50 install_speed = 'Unknown' |
| 49 if 'Error' in battery: | 51 if 'Error' in battery: |
| 50 ac_power = 'Unknown' | 52 ac_power = 'Unknown' |
| 51 battery_level = 'Unknown' | 53 battery_level = 'Unknown' |
| 52 battery_temp = 'Unknown' | 54 battery_temp = 'Unknown' |
| 53 else: | 55 else: |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 parser.add_option('', '--out-dir', | 178 parser.add_option('', '--out-dir', |
| 177 help='Directory where the device path is stored', | 179 help='Directory where the device path is stored', |
| 178 default=os.path.join(os.path.dirname(__file__), '..', | 180 default=os.path.join(os.path.dirname(__file__), '..', |
| 179 '..', 'out')) | 181 '..', 'out')) |
| 180 | 182 |
| 181 options, args = parser.parse_args() | 183 options, args = parser.parse_args() |
| 182 if args: | 184 if args: |
| 183 parser.error('Unknown options %s' % args) | 185 parser.error('Unknown options %s' % args) |
| 184 devices = android_commands.GetAttachedDevices() | 186 devices = android_commands.GetAttachedDevices() |
| 185 types, builds, reports, errors = [], [], [], [] | 187 types, builds, reports, errors = [], [], [], [] |
| 188 fail_step_lst = [] | |
| 186 if devices: | 189 if devices: |
| 187 types, builds, reports, errors, fail_step_lst = zip(*[DeviceInfo(dev) | 190 types, builds, reports, errors, fail_step_lst = zip(*[DeviceInfo(dev) |
| 188 for dev in devices]) | 191 for dev in devices]) |
| 189 | 192 |
| 190 err_msg = CheckForMissingDevices(options, devices) or [] | 193 err_msg = CheckForMissingDevices(options, devices) or [] |
| 191 | 194 |
| 192 unique_types = list(set(types)) | 195 unique_types = list(set(types)) |
| 193 unique_builds = list(set(builds)) | 196 unique_builds = list(set(builds)) |
| 194 | 197 |
| 195 buildbot_report.PrintMsg('Online devices: %d. Device types %s, builds %s' | 198 buildbot_report.PrintMsg('Online devices: %d. Device types %s, builds %s' |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 212 # devices with critically low battery or install speed. Remove those devices | 215 # devices with critically low battery or install speed. Remove those devices |
| 213 # from testing, allowing build to continue with good devices. | 216 # from testing, allowing build to continue with good devices. |
| 214 return 1 | 217 return 1 |
| 215 | 218 |
| 216 if not devices: | 219 if not devices: |
| 217 return 1 | 220 return 1 |
| 218 | 221 |
| 219 | 222 |
| 220 if __name__ == '__main__': | 223 if __name__ == '__main__': |
| 221 sys.exit(main()) | 224 sys.exit(main()) |
| OLD | NEW |