[libvirt] [PATCH 4/4] tests: Add some compatibility-related cases to the CPU tests

Jiri Denemark jdenemar at redhat.com
Fri Aug 21 21:37:30 UTC 2015


On Tue, Aug 18, 2015 at 16:45:07 -0700, Andrea Bolognani wrote:
> ---
>  tests/cputest.c                                            | 14 ++++++++++++++
>  tests/cputestdata/ppc64-guest-compat-incompatible.xml      |  3 +++
>  tests/cputestdata/ppc64-guest-compat-invalid.xml           |  3 +++
>  tests/cputestdata/ppc64-guest-compat-none.xml              |  1 +
>  tests/cputestdata/ppc64-guest-compat-valid.xml             |  3 +++
>  tests/cputestdata/ppc64-guest-host-model.xml               |  3 +++
>  tests/cputestdata/ppc64-host+guest-compat-incompatible.xml |  3 +++
>  tests/cputestdata/ppc64-host+guest-compat-invalid.xml      |  3 +++
>  tests/cputestdata/ppc64-host+guest-compat-none.xml         |  3 +++
>  tests/cputestdata/ppc64-host+guest-compat-valid.xml        |  3 +++
>  tests/cputestdata/ppc64-host+guest-host-model.xml          |  3 +++
>  tests/cputestdata/ppc64-host+guest-legacy-incompatible.xml |  3 +++
>  tests/cputestdata/ppc64-host+guest-legacy-invalid.xml      |  3 +++
>  tests/cputestdata/ppc64-host+guest-legacy.xml              |  3 +++
>  tests/cputestdata/ppc64-host+guest-nofallback.xml          |  3 +++
>  tests/cputestdata/ppc64-host+guest.xml                     |  3 +++
>  16 files changed, 57 insertions(+)
>  create mode 100644 tests/cputestdata/ppc64-guest-compat-incompatible.xml
>  create mode 100644 tests/cputestdata/ppc64-guest-compat-invalid.xml
>  create mode 100644 tests/cputestdata/ppc64-guest-compat-none.xml
>  create mode 100644 tests/cputestdata/ppc64-guest-compat-valid.xml
>  create mode 100644 tests/cputestdata/ppc64-guest-host-model.xml
>  create mode 100644 tests/cputestdata/ppc64-host+guest-compat-incompatible.xml
>  create mode 100644 tests/cputestdata/ppc64-host+guest-compat-invalid.xml
>  create mode 100644 tests/cputestdata/ppc64-host+guest-compat-none.xml
>  create mode 100644 tests/cputestdata/ppc64-host+guest-compat-valid.xml
>  create mode 100644 tests/cputestdata/ppc64-host+guest-host-model.xml
>  create mode 100644 tests/cputestdata/ppc64-host+guest-legacy-incompatible.xml
>  create mode 100644 tests/cputestdata/ppc64-host+guest-legacy-invalid.xml
>  create mode 100644 tests/cputestdata/ppc64-host+guest-legacy.xml
>  create mode 100644 tests/cputestdata/ppc64-host+guest-nofallback.xml
>  create mode 100644 tests/cputestdata/ppc64-host+guest.xml
> 
> diff --git a/tests/cputest.c b/tests/cputest.c
> index 5992dd0..431b587 100644
> --- a/tests/cputest.c
> +++ b/tests/cputest.c
> @@ -607,6 +607,10 @@ mymain(void)
>      DO_TEST_COMPARE("ppc64", "host", "guest-legacy", VIR_CPU_COMPARE_IDENTICAL);
>      DO_TEST_COMPARE("ppc64", "host", "guest-legacy-incompatible", VIR_CPU_COMPARE_INCOMPATIBLE);
>      DO_TEST_COMPARE("ppc64", "host", "guest-legacy-invalid", VIR_CPU_COMPARE_ERROR);
> +    DO_TEST_COMPARE("ppc64", "host", "guest-compat-none", VIR_CPU_COMPARE_IDENTICAL);
> +    DO_TEST_COMPARE("ppc64", "host", "guest-compat-valid", VIR_CPU_COMPARE_IDENTICAL);
> +    DO_TEST_COMPARE("ppc64", "host", "guest-compat-invalid", VIR_CPU_COMPARE_ERROR);

I'm wondering how the above test could have passed when ret was
initialized to VIR_CPU_COMPARE_IDENTICAL in patch 2 :-)

> +    DO_TEST_COMPARE("ppc64", "host", "guest-compat-incompatible", VIR_CPU_COMPARE_INCOMPATIBLE);
>  
>      /* guest updates for migration
>       * automatically compares host CPU with the result */
> @@ -618,6 +622,16 @@ mymain(void)
>      DO_TEST_UPDATE("x86", "host", "host-passthrough", VIR_CPU_COMPARE_IDENTICAL);
>      DO_TEST_UPDATE("x86", "host-invtsc", "host-model", VIR_CPU_COMPARE_SUPERSET);
>  
> +    DO_TEST_UPDATE("ppc64", "host", "guest", VIR_CPU_COMPARE_IDENTICAL);
> +    DO_TEST_UPDATE("ppc64", "host", "guest-nofallback", VIR_CPU_COMPARE_INCOMPATIBLE);
> +    DO_TEST_UPDATE("ppc64", "host", "guest-legacy", VIR_CPU_COMPARE_IDENTICAL);
> +    DO_TEST_UPDATE("ppc64", "host", "guest-legacy-incompatible", VIR_CPU_COMPARE_INCOMPATIBLE);
> +    DO_TEST_UPDATE("ppc64", "host", "guest-legacy-invalid", VIR_CPU_COMPARE_ERROR);
> +    DO_TEST_UPDATE("ppc64", "host", "guest-compat-none", VIR_CPU_COMPARE_IDENTICAL);
> +    DO_TEST_UPDATE("ppc64", "host", "guest-compat-valid", VIR_CPU_COMPARE_IDENTICAL);
> +    DO_TEST_UPDATE("ppc64", "host", "guest-compat-invalid", VIR_CPU_COMPARE_ERROR);
> +    DO_TEST_UPDATE("ppc64", "host", "guest-compat-incompatible", VIR_CPU_COMPARE_INCOMPATIBLE);
> +
>      /* computing baseline CPUs */
>      DO_TEST_BASELINE("x86", "incompatible-vendors", 0, -1);
>      DO_TEST_BASELINE("x86", "no-vendor", 0, 0);
...
> diff --git a/tests/cputestdata/ppc64-host+guest-compat-incompatible.xml b/tests/cputestdata/ppc64-host+guest-compat-incompatible.xml
> new file mode 100644
> index 0000000..1fab751
> --- /dev/null
> +++ b/tests/cputestdata/ppc64-host+guest-compat-incompatible.xml
> @@ -0,0 +1,3 @@
> +<cpu mode='host-model' match='exact'>
> +  <model fallback='allow'>power8</model>
> +</cpu>

The test is supposed to fail for this (and some other cases too) so why
do we need to have an output XML?

Jirka




More information about the libvir-list mailing list