[libvirt] [PATCH 08/12] qemucapabilitiestest: Test all capabilities

Peter Krempa pkrempa at redhat.com
Fri May 6 07:50:02 UTC 2016


On Thu, May 05, 2016 at 18:42:10 +0200, Jiri Denemark wrote:
> Enhance the test to cover all capabilities we probe for rather than
> testing the flags only.
> 
> Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
> ---

[...]

> diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c
> index 80f3cd8..1f2d5d7 100644
> --- a/tests/qemucapabilitiestest.c
> +++ b/tests/qemucapabilitiestest.c

[...]

> @@ -134,17 +137,19 @@ testQemuCaps(const void *opaque)
>      if (!(mon = testQemuFeedMonitor(replies, data->xmlopt)))
>          goto cleanup;
>  
> -    if (!(capsExpected = qemuTestParseCapabilities(capsFile)))
> -        goto cleanup;
> -
> -    if (!(capsActual = virQEMUCapsNew()))
> -        goto cleanup;
> -
> -    if (virQEMUCapsInitQMPMonitor(capsActual,
> +    if (!(capsActual = virQEMUCapsNew()) ||
> +        virQEMUCapsInitQMPMonitor(capsActual,
>                                    qemuMonitorTestGetMonitor(mon)) < 0)
>          goto cleanup;
>  
> -    if (testQemuCapsCompare(capsExpected, capsActual) < 0)
> +    if ((capsExpected = qemuTestParseCapabilities(capsFile)) &&
> +        testQemuCapsFlagsCompare(capsExpected, capsActual) < 0)

So here you compare the flags only ...

> +        goto cleanup;
> +
> +    if (!(actual = virQEMUCapsFormatCache(capsActual, 0, 0)))
> +        goto cleanup;
> +
> +    if (virtTestCompareToFile(actual, capsFile) < 0)

and here you compare them again with the rest of the file. 

>          goto cleanup;
>  
>      ret = 0;

I think the first comparison can be dropped. This would require to fix
the flags first and then in a second run fix all the rest. The second
check should do the trick by itself.

ACK with the first check dropped
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160506/34411ecd/attachment-0001.sig>


More information about the libvir-list mailing list