[libvirt] [PATCH v2 05/10] tests: qemuxml2xml: Add proper domain status XML testing

Jiri Denemark jdenemar at redhat.com
Tue Mar 13 12:29:21 UTC 2018


On Wed, Mar 07, 2018 at 15:42:31 +0100, Peter Krempa wrote:
> Add new approach to properly test status XML files by supplying a full
> XML file rather than generating synthetic test cases by prepending the
> status header. The two tests introduced here are copies of existing
> cases using the synthetic header so that current level of testing is
> kept. The files are chosen to excercising the vcpu and blockjob quirks
> present in the current testing.
> 
> Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> ---
>  tests/Makefile.am                                  |   1 +
>  tests/qemustatusxml2xmldata/blockjob-mirror-in.xml |  96 ++++++
>  .../qemustatusxml2xmldata/blockjob-mirror-out.xml  |   1 +
>  tests/qemustatusxml2xmldata/vcpus-multi-in.xml     | 343 +++++++++++++++++++++
>  tests/qemustatusxml2xmldata/vcpus-multi-out.xml    |   1 +
>  tests/qemuxml2xmltest.c                            | 108 ++++++-
>  6 files changed, 543 insertions(+), 7 deletions(-)
>  create mode 100644 tests/qemustatusxml2xmldata/blockjob-mirror-in.xml
>  create mode 120000 tests/qemustatusxml2xmldata/blockjob-mirror-out.xml
>  create mode 100644 tests/qemustatusxml2xmldata/vcpus-multi-in.xml
>  create mode 120000 tests/qemustatusxml2xmldata/vcpus-multi-out.xml

:set nitpicking=on

...
> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
> index b1fc6a2d28..2c1fa58bce 100644
> --- a/tests/qemuxml2xmltest.c
> +++ b/tests/qemuxml2xmltest.c
...
> @@ -397,8 +473,8 @@ mymain(void)
>                              testXML2XMLActive, &info) < 0) \
>                  ret = -1; \
>   \
> -            if (virTestRun("QEMU XML-2-XML-status " name, \
> -                            testCompareStatusXMLToXMLFiles, &info) < 0) \
> +            if (virTestRun("QEMU XML-2-XML-status (old)" name, \
> +                            testCompareStatusXMLToXMLOldFiles, &info) < 0) \

You could have fixed the indentation too: s/ t/t/

>                  ret = -1; \
>          } \
>          testInfoClear(&info); \
> @@ -1347,6 +1423,24 @@ mymain(void)
>      DO_TEST("disk-many-format-probing", NONE);
>      driver.config->allowDiskFormatProbing = false;
> 
> +# define DO_TEST_STATUS(name) \
> +    do { \
> +        if (testInfoSetStatus(&info, name, GIC_NONE) < 0) { \
> +            VIR_TEST_DEBUG("Failed to generate status test data for '%s'", name); \
> +            return -1; \
> +        } \
> + \
> +        if (virTestRun("QEMU status XML-2-XML " name, \
> +                        testCompareStatusXMLToXMLFiles, &info) < 0) \

Dtto.

> +                ret = -1; \

Looks like a copy-pasta remnant :-) s/    //

ACK

Jirka




More information about the libvir-list mailing list