Re: [libvirt PATCH 9/9] tests: Add tests for unknown elements and attributes in cpu defintion

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

 



On Mon, 2020-09-21 at 15:07 +0200, Tim Wiederhake wrote:
> Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
> ---
>  tests/cputest.c                              | 4 ++++
>  tests/cputestdata/x86_64-bogus-attribute.xml | 2 ++
>  tests/cputestdata/x86_64-bogus-element.xml   | 3 +++
>  3 files changed, 9 insertions(+)
>  create mode 100644 tests/cputestdata/x86_64-bogus-attribute.xml
>  create mode 100644 tests/cputestdata/x86_64-bogus-element.xml
> 
> diff --git a/tests/cputest.c b/tests/cputest.c
> index 30a125c3da..2d00040497 100644
> --- a/tests/cputest.c
> +++ b/tests/cputest.c
> @@ -1106,6 +1106,10 @@ mymain(void)
>          } \
>      } while (0)
>  
> +    /* invalid xml */
> +    DO_TEST_COMPARE_FLAGS(VIR_ARCH_X86_64, "host", "bogus-element",
> VIR_CPU_COMPARE_ERROR, VIR_CONNECT_COMPARE_CPU_VALIDATE_XML);
> +    DO_TEST_COMPARE_FLAGS(VIR_ARCH_X86_64, "host", "bogus-
> attribute", VIR_CPU_COMPARE_ERROR,
> VIR_CONNECT_COMPARE_CPU_VALIDATE_XML);
> +
>      /* host to host comparison */
>      DO_TEST_COMPARE(VIR_ARCH_X86_64, "host", "host",
> VIR_CPU_COMPARE_IDENTICAL);
>      DO_TEST_COMPARE(VIR_ARCH_X86_64, "host", "host-better",
> VIR_CPU_COMPARE_INCOMPATIBLE);
> diff --git a/tests/cputestdata/x86_64-bogus-attribute.xml
> b/tests/cputestdata/x86_64-bogus-attribute.xml
> new file mode 100644
> index 0000000000..073ee793e6
> --- /dev/null
> +++ b/tests/cputestdata/x86_64-bogus-attribute.xml
> @@ -0,0 +1,2 @@
> +<cpu nonExistantAttribute="">

nickpick: the proper spelling is "existent"

> +</cpu>
> diff --git a/tests/cputestdata/x86_64-bogus-element.xml
> b/tests/cputestdata/x86_64-bogus-element.xml
> new file mode 100644
> index 0000000000..79f98bad18
> --- /dev/null
> +++ b/tests/cputestdata/x86_64-bogus-element.xml
> @@ -0,0 +1,3 @@
> +<cpu>
> +  <nonExistantElement/>

again.

> +</cpu>




[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