iotests: add support for capturing and matching QMP events
commitaae12d4baa1304756c073fac34ac53e6445f4fdf
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 4 Feb 2021 12:48:32 +0000 (4 12:48 +0000)
committerDr. David Alan Gilbert <dgilbert@redhat.com>
Mon, 8 Feb 2021 11:19:51 +0000 (8 11:19 +0000)
tree0f35b35750fcdb501b7fdb702b1485c1160874e3
parentbef7e9e2c7549696f7ddbe3a1dd236531d2af518
iotests: add support for capturing and matching QMP events

When using the _launch_qemu and _send_qemu_cmd functions from
common.qemu, any QMP events get mixed in with the output from
the commands and responses.

This makes it difficult to write a test case as the ordering
of events in the output is not stable.

This introduces a variable 'capture_events' which can be set
to a list of event names. Any events listed in this variable
will not be printed, instead collected in the $QEMU_EVENTS
environment variable.

A new '_wait_event' function can be invoked to collect events
at a fixed point in time. The function will first pull events
cached in $QEMU_EVENTS variable, and if none are found, will
then read more from QMP.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20210204124834.774401-11-berrange@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
tests/qemu-iotests/common.qemu