Re: [PATCH] qemumonitorjsontest: Validate more commands against schema

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
> ---
>  tests/qemumonitorjsontest.c | 251 +++++++++++++++++++++---------------
>  1 file changed, 149 insertions(+), 102 deletions(-)

ACK, it's good to see that actually everything was compliant :).

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux