[libvirt] [PATCH] tests: Add DO_TEST_PARSE_ERROR() to qemuxml2xml

Peter Krempa pkrempa at redhat.com
Fri Jul 7 10:48:37 UTC 2017


On Tue, Jul 04, 2017 at 15:13:51 +0200, Andrea Bolognani wrote:
> qemuxml2argv already supports the ability to include test
> cases that are known not to make it past XML parsing, and
> since we want to keep qemuxml2xml in sync with it as much
> as possible, we need to implement this missing feature.

I must say that I don't really see the point to have them fail twice ...

I'd understand if this would be added to the genericxml2xmltest (if it's
not there)

> 
> Signed-off-by: Andrea Bolognani <abologna at redhat.com>
> ---
>  tests/qemuxml2xmltest.c | 104 +++++++++++++++++++++++++++++++-----------------
>  1 file changed, 67 insertions(+), 37 deletions(-)
> 
> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
> index c74614c..66729fa 100644
> --- a/tests/qemuxml2xmltest.c
> +++ b/tests/qemuxml2xmltest.c

> @@ -217,6 +231,17 @@ testCompareStatusXMLToXMLFiles(const void *opaque)
>  
>      ret = 0;
>  
> + ok:

This is not an okay name for a label.

> +    if (data->flags & FLAG_EXPECT_PARSE_ERROR) {
> +        if (ret < 0) {
> +            VIR_TEST_DEBUG("Got expected error");
> +            ret = 0;

The rest looks good, but the explanation for need to do this is not that
convincing, since testing the same thing twice does not really make
sense.

I'd make more sense if you plan to move the cases which are supposed to
fail here, since this is the test dealing with XML parsing.
-------------- 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/20170707/f193f8c2/attachment-0001.sig>


More information about the libvir-list mailing list