qemu-iotests: add option in common.qemu for mismatch only
Add option to echo response to QMP / HMP command only on mismatch. Useful for ignore all normal responses, but catching things like segfaults. Signed-off-by: Jeff Cody <jcody@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
6133b39f3c
commit
a2339699c3
@ -50,6 +50,8 @@ _in_fd=4
|
|||||||
#
|
#
|
||||||
# If $silent is set to anything but an empty string, then
|
# If $silent is set to anything but an empty string, then
|
||||||
# response is not echoed out.
|
# response is not echoed out.
|
||||||
|
# If $mismatch_only is set, only non-matching responses will
|
||||||
|
# be echoed.
|
||||||
function _timed_wait_for()
|
function _timed_wait_for()
|
||||||
{
|
{
|
||||||
local h=${1}
|
local h=${1}
|
||||||
@ -58,14 +60,18 @@ function _timed_wait_for()
|
|||||||
QEMU_STATUS[$h]=0
|
QEMU_STATUS[$h]=0
|
||||||
while IFS= read -t ${QEMU_COMM_TIMEOUT} resp <&${QEMU_OUT[$h]}
|
while IFS= read -t ${QEMU_COMM_TIMEOUT} resp <&${QEMU_OUT[$h]}
|
||||||
do
|
do
|
||||||
if [ -z "${silent}" ]; then
|
if [ -z "${silent}" ] && [ -z "${mismatch_only}" ]; then
|
||||||
echo "${resp}" | _filter_testdir | _filter_qemu \
|
echo "${resp}" | _filter_testdir | _filter_qemu \
|
||||||
| _filter_qemu_io | _filter_qmp | _filter_hmp
|
| _filter_qemu_io | _filter_qmp | _filter_hmp
|
||||||
fi
|
fi
|
||||||
grep -q "${*}" < <(echo "${resp}")
|
grep -q "${*}" < <(echo "${resp}")
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
return
|
return
|
||||||
|
elif [ -z "${silent}" ] && [ -n "${mismatch_only}" ]; then
|
||||||
|
echo "${resp}" | _filter_testdir | _filter_qemu \
|
||||||
|
| _filter_qemu_io | _filter_qmp | _filter_hmp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
QEMU_STATUS[$h]=-1
|
QEMU_STATUS[$h]=-1
|
||||||
if [ -z "${qemu_error_no_exit}" ]; then
|
if [ -z "${qemu_error_no_exit}" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user