[libvirt] [PATCH v2 08/11] tests: qemuxml2argv cpu feature syntax

Jiri Denemark jdenemar at redhat.com
Thu Dec 15 16:10:13 UTC 2016


On Fri, Dec 09, 2016 at 14:38:37 -0500, Jason J. Herne wrote:
> Test that libvirt generates the correct cpu feature syntax when
> query-cpu-model-expansion is supported and when it is not.
> 
> Signed-off-by: Jason J. Herne <jjherne at linux.vnet.ibm.com>
> ---
>  .../qemuxml2argv-cpu-features-post-qcme.args       | 19 ++++++++++++++++++
>  .../qemuxml2argv-cpu-features-post-qcme.xml        | 23 ++++++++++++++++++++++
>  .../qemuxml2argv-cpu-features-pre-qcme.args        | 19 ++++++++++++++++++
>  .../qemuxml2argv-cpu-features-pre-qcme.xml         | 23 ++++++++++++++++++++++
>  tests/qemuxml2argvtest.c                           |  7 +++++++
>  5 files changed, 91 insertions(+)
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-features-post-qcme.args
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-features-post-qcme.xml
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-features-pre-qcme.args
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-features-pre-qcme.xml
...
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-features-pre-qcme.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-features-pre-qcme.args
> new file mode 100644
> index 0000000..4622014
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-features-pre-qcme.args
> @@ -0,0 +1,19 @@
> +LC_ALL=C \
> +PATH=/bin \
> +HOME=/home/test \
> +USER=test \
> +LOGNAME=test \
> +QEMU_AUDIO_DRV=none \
> +/usr/bin/qemu-kvm \
> +-name guest1 \
> +-S \
> +-M s390-ccw-virtio \
> +-cpu zEC12,+dfppc,-stckf \

This doesn't make sense since QEMU won't accept such syntax, would it?

> +-m 214 \
> +-smp 1,sockets=1,cores=1,threads=1 \
> +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
> +-nographic \
> +-nodefaults \
> +-monitor unix:/tmp/lib/domain--1-guest1/monitor.sock,server,nowait \
> +-no-acpi \
> +-boot c
...
> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> index bd2cdcb..1478d17 100644
> --- a/tests/qemuxml2argvtest.c
> +++ b/tests/qemuxml2argvtest.c
> @@ -1522,6 +1522,13 @@ mymain(void)
>  
>      qemuTestSetHostArch(driver.caps, VIR_ARCH_S390X);
>      DO_TEST("cpu-s390-zEC12", QEMU_CAPS_KVM, QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
> +
> +    /* Cpu feature tests for both possible formats:
> +     * Qemu < 2.8  : no query-cpu-model-expansion support : +/-feature format
> +     * Qemu >= 2.8 : query-cpu-model-expansion support    : feature=state format
> +     */
> +    DO_TEST("cpu-features-post-qcme", QEMU_CAPS_KVM, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION);
> +    DO_TEST("cpu-features-pre-qcme", QEMU_CAPS_KVM);

We already have a lot of tests that use the +/-feature syntax so there's
no real need to add another one. However, we could use it as a negative
test since s390 does not support the old syntax. So how about:

    DO_TEST("cpu-s390-features", QEMU_CAPS_KVM,
            QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION);
    DO_TEST_FAILURE("cpu-s390-features", QEMU_CAPS_KVM);

Of course, patch 5/11 would need to be modified to actually refuse to
start an s390 domain with CPU features in the XML on QEMU without
QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION capability.

Jirka




More information about the libvir-list mailing list