Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(549)

Unified Diff: build/android/device_status_check.py

Issue 19284009: Add option to output device status data in format for dashboard. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/pylib/android_commands.py » ('j') | build/android/pylib/android_commands.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/device_status_check.py
diff --git a/build/android/device_status_check.py b/build/android/device_status_check.py
index cd8415378bb5ce6388978dec86cd62aafd74f71d..292ad15e8f720a53bbdf7d5dca45ecdf5f494b30 100755
--- a/build/android/device_status_check.py
+++ b/build/android/device_status_check.py
@@ -29,21 +29,19 @@ def DeviceInfo(serial, options):
boolean indicating whether or not device can be used for testing.
"""
- def AdbShellCmd(cmd):
- return GetCmdOutput('adb -s %s shell %s' % (serial, cmd),
- shell=True).strip()
-
device_adb = android_commands.AndroidCommands(serial)
- # TODO(navabi): Replace AdbShellCmd with device_adb.
- device_type = AdbShellCmd('getprop ro.build.product')
- device_build = AdbShellCmd('getprop ro.build.id')
- device_build_type = AdbShellCmd('getprop ro.build.type')
- device_product_name = AdbShellCmd('getprop ro.product.name')
+ def AdbShellCommand(cmd):
+ return '\n'.join(device_adb.RunShellCommand(cmd))
+
+ device_type = AdbShellCommand('getprop ro.build.product')
+ device_build = AdbShellCommand('getprop ro.build.id')
+ device_build_type = AdbShellCommand('getprop ro.build.type')
+ device_product_name = AdbShellCommand('getprop ro.product.name')
- setup_wizard_disabled = AdbShellCmd(
+ setup_wizard_disabled = device_adb.RunShellCommand(
'getprop ro.setupwizard.mode') == 'DISABLED'
- battery = AdbShellCmd('dumpsys battery')
+ battery = AdbShellCommand('dumpsys battery')
install_output = GetCmdOutput(
['%s/build/android/adb_install_apk.py' % constants.DIR_SOURCE_ROOT, '--apk',
'%s/build/android/CheckInstallApk-debug.apk' % constants.DIR_SOURCE_ROOT])
@@ -61,14 +59,15 @@ def DeviceInfo(serial, options):
battery_level = int(re.findall('level: (\d+)', battery)[0])
battery_temp = float(re.findall('temperature: (\d+)', battery)[0]) / 10
report = ['Device %s (%s)' % (serial, device_type),
- ' Build: %s (%s)' % (device_build,
- AdbShellCmd('getprop ro.build.fingerprint')),
+ ' Build: %s (%s)' %
+ (device_build,
+ AdbShellCommand('getprop ro.build.fingerprint')),
' Battery: %s%%' % battery_level,
' Battery temp: %s' % battery_temp,
- ' IMEI slice: %s' % AdbShellCmd('dumpsys iphonesubinfo '
- '| grep Device'
- "| awk '{print $4}'")[-6:],
- ' Wifi IP: %s' % AdbShellCmd('getprop dhcp.wlan0.ipaddress'),
+ ' IMEI slice: %s' % AdbShellCommand('dumpsys iphonesubinfo '
+ '| grep Device'
+ "| awk '{print $4}'")[-6:],
+ ' Wifi IP: %s' % AdbShellCommand('getprop dhcp.wlan0.ipaddress'),
' Install Speed: %s KB/s' % install_speed,
'']
@@ -90,8 +89,9 @@ def DeviceInfo(serial, options):
# Turn off devices with low battery and the step does not fail.
if battery_level < 15:
device_adb.EnableAdbRoot()
- AdbShellCmd('reboot -p')
- return device_type, device_build, '\n'.join(report), errors, True
+ AdbShellCommand('reboot -p')
+ full_report = '\n'.join(report)
+ return device_type, device_build, battery_level, full_report, errors, True
def CheckForMissingDevices(options, adb_online_devs):
@@ -189,16 +189,28 @@ def main():
parser.add_option('--no-provisioning-check',
help='Will not check if devices are provisioned properly.')
+ parser.add_option('--device-status-dashboard',
+ help='Output device status data for dashboard.')
+
options, args = parser.parse_args()
if args:
parser.error('Unknown options %s' % args)
devices = android_commands.GetAttachedDevices()
- types, builds, reports, errors = [], [], [], []
+ offline_devices = android_commands.GetAttachedOfflineDevices()
+
+ types, builds, batteries, reports, errors = [], [], [], [], []
fail_step_lst = []
if devices:
- types, builds, reports, errors, fail_step_lst = (
+ types, builds, batteries, reports, errors, fail_step_lst = (
zip(*[DeviceInfo(dev, options) for dev in devices]))
+ if options.device_status_dashboard:
+ print '<*>RESULT OnlineDevices: OnlineDevices= %s' % len(devices)
frankf 2013/07/16 17:51:19 You can probably use pylib/perf_tests_helper.py
navabi 2013/07/16 19:01:16 Done.
+ print 'RESULT OfflineDevices: OfflineDevice= %s' % len(offline_devices)
+ for serial, battery in zip(devices, batteries):
+ print 'RESULT DeviceBattery: %s= %s' % (serial, battery)
+ return 0
frankf 2013/07/16 17:51:19 Why return here?
navabi 2013/07/16 19:01:16 The idea was that this will be a separate step fro
+
err_msg = CheckForMissingDevices(options, devices) or []
unique_types = list(set(types))
« no previous file with comments | « no previous file | build/android/pylib/android_commands.py » ('j') | build/android/pylib/android_commands.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698