iotests: _filter_qmp for pretty JSON output
authorMax Reitz <mreitz@redhat.com>
Mon, 17 Nov 2014 12:31:05 +0000 (13:31 +0100)
committerKevin Wolf <kwolf@redhat.com>
Wed, 10 Dec 2014 09:25:30 +0000 (10:25 +0100)
_filter_qmp should be able to correctly filter out the QMP version
object for pretty JSON output.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
tests/qemu-iotests/common.filter

index 3acdb30..dfb9726 100644 (file)
@@ -167,7 +167,9 @@ _filter_qmp()
 {
     _filter_win32 | \
     sed -e 's#\("\(micro\)\?seconds": \)[0-9]\+#\1 TIMESTAMP#g' \
-        -e 's#^{"QMP":.*}$#QMP_VERSION#'
+        -e 's#^{"QMP":.*}$#QMP_VERSION#' \
+        -e '/^    "QMP": {\s*$/, /^    }\s*$/ c\' \
+        -e '    QMP_VERSION'
 }
 
 # replace driver-specific options in the "Formatting..." line