Index: build/android/buildbot/bb_device_status_check.py |
diff --git a/build/android/buildbot/bb_device_status_check.py b/build/android/buildbot/bb_device_status_check.py |
index 1a238de9a054febd12cfde75b76b53d6016eaf5e..4c55b4848192e20247abd5e05869f78bba1cf434 100755 |
--- a/build/android/buildbot/bb_device_status_check.py |
+++ b/build/android/buildbot/bb_device_status_check.py |
@@ -5,6 +5,7 @@ |
# found in the LICENSE file. |
"""A class to keep track of devices across builds and report state.""" |
+import json |
import logging |
import optparse |
import os |
@@ -275,6 +276,8 @@ def main(): |
help='Output device status data for dashboard.') |
parser.add_option('--restart-usb', action='store_true', |
help='Restart USB ports before running device check.') |
+ parser.add_option('--json-output', |
+ help='Output JSON information into a specified file.') |
options, args = parser.parse_args() |
if args: |
@@ -359,6 +362,16 @@ def main(): |
[battery], '%', |
'unimportant') |
+ if options.json_output: |
+ with open(options.json_output, 'wb') as f: |
+ f.write(json.dumps({ |
+ 'online_devices': devices, |
+ 'offline_devices': offline_devices, |
+ 'expected_devices': expected_devices, |
+ 'unique_types': unique_types, |
+ 'unique_builds': unique_builds, |
+ })) |
+ |
if False in fail_step_lst: |
# TODO(navabi): Build fails on device status check step if there exists any |
# devices with critically low battery. Remove those devices from testing, |