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

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



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 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

Attachment: signature.asc
Description: Digital signature


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