[libvirt] [PATCH] qemumonitorjsontest: Validate more commands against schema
Peter Krempa
pkrempa at redhat.com
Tue Jun 11 07:18:22 UTC 2019
On Mon, Jun 10, 2019 at 10:30:44 -0500, Eric Blake wrote:
> The DO_TEST() macro in qemumonitorjsontest.c was not passing the
> schema through, which meant that we were not validating any of those
> tests for correct usage according to the schema.
>
> Tested by using this hack, where the test mistakenly passed pre-patch,
> but correctly diagnosed the garbage post-patch:
>
> | diff --git i/src/qemu/qemu_monitor_json.c w/src/qemu/qemu_monitor_json.c
> | index 53a7de8b77..86d8450814 100644
> | --- i/src/qemu/qemu_monitor_json.c
> | +++ w/src/qemu/qemu_monitor_json.c
> | @@ -1532,7 +1532,8 @@ qemuMonitorJSONGetStatus(qemuMonitorPtr mon,
> | if (reason)
> | *reason = VIR_DOMAIN_PAUSED_UNKNOWN;
> |
> | - if (!(cmd = qemuMonitorJSONMakeCommand("query-status", NULL)))
> | + if (!(cmd = qemuMonitorJSONMakeCommand("query-status",
> | + "s:garbage", "foo", NULL)))
I use the same trick when testing these :)
> | return -1;
> |
> | if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
>
> Suggested-by: Peter Krempa <pkrempa at redhat.com>
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
> tests/qemumonitorjsontest.c | 251 +++++++++++++++++++++---------------
> 1 file changed, 149 insertions(+), 102 deletions(-)
ACK, it's good to see that actually everything was compliant :).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190611/e29d75b5/attachment-0001.sig>
More information about the libvir-list
mailing list