On 11/11/2014 06:34 AM, Max Reitz wrote: > _filter_qmp should be able to correctly filter out the QMP version > object for pretty JSON output. > > Signed-off-by: Max Reitz <mre...@redhat.com> > --- > tests/qemu-iotests/common.filter | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) > > diff --git a/tests/qemu-iotests/common.filter > b/tests/qemu-iotests/common.filter > index 3acdb30..e24dab4 100644 > --- a/tests/qemu-iotests/common.filter > +++ b/tests/qemu-iotests/common.filter > @@ -165,9 +165,23 @@ _filter_qemu() > # replace problematic QMP output like timestamps > _filter_qmp() > { > + discard=0 > + > _filter_win32 | \ > sed -e 's#\("\(micro\)\?seconds": \)[0-9]\+#\1 TIMESTAMP#g' \ > - -e 's#^{"QMP":.*}$#QMP_VERSION#' > + -e 's#^{"QMP":.*}$#QMP_VERSION#' \ > + -e 's#\\#\\\\#g' | \ > + while IFS='' read line; do > + if [[ $line == ' "QMP": {' ]]; then
Good that this is a /bin/bash script and not /bin/sh :) But - is it really worth doing this in shell? Why not just do it in sed? sed -e ... \ -e 's#\\#\\\\#g' \ -e '/ "QMP": {/,/ }/ c\' \ -e ' QMP_VERSION' -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature