For each QEMU version there are usually several different, architecture-dependedn scenarios that we're interested in testing; however, since the test matrix has to be explicitly created by calling DO_TEST_QEMU() multiple times with different arguments, we end up with spotty coverage. Fix this by implementing the arch-specific rules in code, which result in the full coverage for a (version, arch) combo being automatically achieved with a single call to DO_TEST_QEMU(). Unsurprisingly, this change results in a bunch of extra output files being created. Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> --- .../domaincapsdata/qemu_1.7.0-q35.x86_64.xml | 134 +++++++++++++ .../domaincapsdata/qemu_1.7.0-tcg.x86_64.xml | 134 +++++++++++++ .../domaincapsdata/qemu_2.12.0-q35.x86_64.xml | 172 ++++++++++++++++ .../domaincapsdata/qemu_2.12.0-tcg.x86_64.xml | 186 +++++++++++++++++ tests/domaincapsdata/qemu_2.12.0.aarch64.xml | 138 +++++++++++++ .../domaincapsdata/qemu_2.6.0-q35.x86_64.xml | 143 ++++++++++++++ .../domaincapsdata/qemu_2.6.0-tcg.x86_64.xml | 143 ++++++++++++++ .../domaincapsdata/qemu_2.8.0-q35.x86_64.xml | 144 ++++++++++++++ .../domaincapsdata/qemu_3.1.0-q35.x86_64.xml | 172 ++++++++++++++++ .../domaincapsdata/qemu_3.1.0-tcg.x86_64.xml | 187 ++++++++++++++++++ .../domaincapsdata/qemu_4.0.0-q35.x86_64.xml | 172 ++++++++++++++++ .../domaincapsdata/qemu_4.0.0-tcg.x86_64.xml | 187 ++++++++++++++++++ .../domaincapsdata/qemu_4.1.0-q35.x86_64.xml | 176 +++++++++++++++++ .../domaincapsdata/qemu_4.1.0-tcg.x86_64.xml | 187 ++++++++++++++++++ .../domaincapsdata/qemu_4.2.0-q35.x86_64.xml | 176 +++++++++++++++++ .../domaincapsdata/qemu_4.2.0-tcg.x86_64.xml | 187 ++++++++++++++++++ .../qemu_4.2.0-virt.aarch64.xml | 150 ++++++++++++++ tests/domaincapstest.c | 102 +++++++--- 18 files changed, 2859 insertions(+), 31 deletions(-) create mode 100644 tests/domaincapsdata/qemu_1.7.0-q35.x86_64.xml create mode 100644 tests/domaincapsdata/qemu_1.7.0-tcg.x86_64.xml create mode 100644 tests/domaincapsdata/qemu_2.12.0-q35.x86_64.xml create mode 100644 tests/domaincapsdata/qemu_2.12.0-tcg.x86_64.xml create mode 100644 tests/domaincapsdata/qemu_2.12.0.aarch64.xml create mode 100644 tests/domaincapsdata/qemu_2.6.0-q35.x86_64.xml create mode 100644 tests/domaincapsdata/qemu_2.6.0-tcg.x86_64.xml create mode 100644 tests/domaincapsdata/qemu_2.8.0-q35.x86_64.xml create mode 100644 tests/domaincapsdata/qemu_3.1.0-q35.x86_64.xml create mode 100644 tests/domaincapsdata/qemu_3.1.0-tcg.x86_64.xml create mode 100644 tests/domaincapsdata/qemu_4.0.0-q35.x86_64.xml create mode 100644 tests/domaincapsdata/qemu_4.0.0-tcg.x86_64.xml create mode 100644 tests/domaincapsdata/qemu_4.1.0-q35.x86_64.xml create mode 100644 tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml create mode 100644 tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml create mode 100644 tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml create mode 100644 tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml diff --git a/tests/domaincapsdata/qemu_1.7.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_1.7.0-q35.x86_64.xml new file mode 100644 index 0000000000..79b753fa09 --- /dev/null +++ b/tests/domaincapsdata/qemu_1.7.0-q35.x86_64.xml @@ -0,0 +1,134 @@ +<domainCapabilities> + <path>/usr/bin/qemu-system-x86_64</path> + <domain>kvm</domain> + <machine>pc-q35-1.7</machine> + <arch>x86_64</arch> + <vcpu max='255'/> + <iothreads supported='no'/> + <os supported='yes'> + <enum name='firmware'> + <value>bios</value> + <value>efi</value> + </enum> + <loader supported='yes'> + <value>/usr/share/AAVMF/AAVMF_CODE.fd</value> + <value>/usr/share/AAVMF/AAVMF32_CODE.fd</value> + <value>/usr/share/OVMF/OVMF_CODE.fd</value> + <enum name='type'> + <value>rom</value> + <value>pflash</value> + </enum> + <enum name='readonly'> + <value>yes</value> + <value>no</value> + </enum> + <enum name='secure'> + <value>yes</value> + <value>no</value> + </enum> + </loader> + </os> + <cpu> + <mode name='host-passthrough' supported='yes'/> + <mode name='host-model' supported='yes'> + <model fallback='allow'>Broadwell</model> + </mode> + <mode name='custom' supported='yes'> + <model usable='unknown'>Opteron_G5</model> + <model usable='unknown'>Opteron_G4</model> + <model usable='unknown'>Opteron_G3</model> + <model usable='unknown'>Opteron_G2</model> + <model usable='unknown'>Opteron_G1</model> + <model usable='unknown'>Haswell</model> + <model usable='unknown'>SandyBridge</model> + <model usable='unknown'>Westmere</model> + <model usable='unknown'>Nehalem</model> + <model usable='unknown'>Penryn</model> + <model usable='unknown'>Conroe</model> + <model usable='unknown'>n270</model> + <model usable='unknown'>athlon</model> + <model usable='unknown'>pentium3</model> + <model usable='unknown'>pentium2</model> + <model usable='unknown'>pentium</model> + <model usable='unknown'>486</model> + <model usable='unknown'>coreduo</model> + <model usable='unknown'>kvm32</model> + <model usable='unknown'>qemu32</model> + <model usable='unknown'>kvm64</model> + <model usable='unknown'>core2duo</model> + <model usable='unknown'>phenom</model> + <model usable='unknown'>qemu64</model> + </mode> + </cpu> + <devices> + <disk supported='yes'> + <enum name='diskDevice'> + <value>disk</value> + <value>cdrom</value> + <value>floppy</value> + <value>lun</value> + </enum> + <enum name='bus'> + <value>fdc</value> + <value>scsi</value> + <value>virtio</value> + <value>usb</value> + <value>sata</value> + </enum> + <enum name='model'> + <value>virtio</value> + </enum> + </disk> + <graphics supported='yes'> + <enum name='type'> + <value>sdl</value> + <value>vnc</value> + <value>spice</value> + </enum> + </graphics> + <video supported='yes'> + <enum name='modelType'> + <value>vga</value> + <value>cirrus</value> + <value>vmvga</value> + <value>qxl</value> + </enum> + </video> + <hostdev supported='yes'> + <enum name='mode'> + <value>subsystem</value> + </enum> + <enum name='startupPolicy'> + <value>default</value> + <value>mandatory</value> + <value>requisite</value> + <value>optional</value> + </enum> + <enum name='subsysType'> + <value>usb</value> + <value>pci</value> + <value>scsi</value> + </enum> + <enum name='capsType'/> + <enum name='pciBackend'> + <value>default</value> + <value>vfio</value> + </enum> + </hostdev> + <rng supported='yes'> + <enum name='model'> + <value>virtio</value> + </enum> + <enum name='backendModel'> + <value>random</value> + <value>egd</value> + </enum> + </rng> + </devices> + <features> + <gic supported='no'/> + <vmcoreinfo supported='no'/> + <genid supported='no'/> + <sev supported='no'/> + </features> +</domainCapabilities> [... many more files like this one get generated ...] diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c index e3329ef1ff..4476423228 100644 --- a/tests/domaincapstest.c +++ b/tests/domaincapstest.c @@ -267,11 +267,11 @@ test_virDomainCapsFormat(const void *opaque) } static int -doTestQemu(const char *version, - const char *machine, - const char *arch, - virDomainVirtType type, - void *opaque) +doTestQemuInternal(const char *version, + const char *machine, + const char *arch, + virDomainVirtType type, + void *opaque) { g_autofree char *name = NULL; g_autofree char *capsName = NULL; @@ -302,6 +302,50 @@ doTestQemu(const char *version, return 0; } +static int +doTestQemu(const char *version, + const char *arch, + void *opaque) +{ + if (STREQ(arch, "x86_64")) { + /* For x86_64 we test three combinations: + * + * - KVM with default machine + * - KVM with Q35 machine + * - TCG with default machine + */ + if (doTestQemuInternal(version, NULL, arch, + VIR_DOMAIN_VIRT_KVM, opaque) < 0 || + doTestQemuInternal(version, "q35", arch, + VIR_DOMAIN_VIRT_KVM, opaque) < 0 || + doTestQemuInternal(version, NULL, arch, + VIR_DOMAIN_VIRT_QEMU, opaque) < 0) { + return -1; + } + } else if (STREQ(arch, "aarch64")) { + /* For aarch64 we test two combinations: + * + * - KVM with default machine + * - KVM with virt machine + */ + if (doTestQemuInternal(version, NULL, arch, + VIR_DOMAIN_VIRT_KVM, opaque) < 0 || + doTestQemuInternal(version, "virt", arch, + VIR_DOMAIN_VIRT_KVM, opaque) < 0) { + return -1; + } + } else if (STRPREFIX(arch, "riscv")) { + /* Unfortunately we have to skip RISC-V at the moment */ + return 0; + } else { + if (doTestQemuInternal(version, NULL, arch, + VIR_DOMAIN_VIRT_KVM, opaque) < 0) + return -1; + } + + return 0; +} + static int mymain(void) { @@ -332,9 +376,9 @@ mymain(void) ret = -1; \ } while (0) -#define DO_TEST_QEMU(Version, Machine, Arch, Type) \ +#define DO_TEST_QEMU(Version, Arch) \ do { \ - if (doTestQemu(Version, Machine, Arch, Type, cfg) < 0) \ + if (doTestQemu(Version, Arch, cfg) < 0) \ ret = -1; \ } while (0) @@ -384,40 +428,36 @@ mymain(void) virFileWrapperAddPrefix("/home/user/.config/qemu/firmware", abs_srcdir "/qemufirmwaredata/home/user/.config/qemu/firmware"); - DO_TEST_QEMU("1.7.0", NULL, "x86_64", VIR_DOMAIN_VIRT_KVM); + DO_TEST_QEMU("1.7.0", "x86_64"); - DO_TEST_QEMU("2.6.0", NULL, "x86_64", VIR_DOMAIN_VIRT_KVM); - DO_TEST_QEMU("2.6.0", NULL, "aarch64", VIR_DOMAIN_VIRT_KVM); - DO_TEST_QEMU("2.6.0", "virt", "aarch64", VIR_DOMAIN_VIRT_KVM); - DO_TEST_QEMU("2.6.0", NULL, "ppc64", VIR_DOMAIN_VIRT_KVM); + DO_TEST_QEMU("2.6.0", "x86_64"); + DO_TEST_QEMU("2.6.0", "aarch64"); + DO_TEST_QEMU("2.6.0", "ppc64"); - DO_TEST_QEMU("2.7.0", NULL, "s390x", VIR_DOMAIN_VIRT_KVM); + DO_TEST_QEMU("2.7.0", "s390x"); - DO_TEST_QEMU("2.8.0", NULL, "x86_64", VIR_DOMAIN_VIRT_KVM); - DO_TEST_QEMU("2.8.0", NULL, "x86_64", VIR_DOMAIN_VIRT_QEMU); - DO_TEST_QEMU("2.8.0", NULL, "s390x", VIR_DOMAIN_VIRT_KVM); + DO_TEST_QEMU("2.8.0", "x86_64"); + DO_TEST_QEMU("2.8.0", "s390x"); - DO_TEST_QEMU("2.9.0", NULL, "x86_64", VIR_DOMAIN_VIRT_KVM); - DO_TEST_QEMU("2.9.0", "q35", "x86_64", VIR_DOMAIN_VIRT_KVM); - DO_TEST_QEMU("2.9.0", NULL, "x86_64", VIR_DOMAIN_VIRT_QEMU); + DO_TEST_QEMU("2.9.0", "x86_64"); - DO_TEST_QEMU("2.12.0", NULL, "x86_64", VIR_DOMAIN_VIRT_KVM); - DO_TEST_QEMU("2.12.0", "virt", "aarch64", VIR_DOMAIN_VIRT_KVM); - DO_TEST_QEMU("2.12.0", NULL, "ppc64", VIR_DOMAIN_VIRT_KVM); - DO_TEST_QEMU("2.12.0", NULL, "s390x", VIR_DOMAIN_VIRT_KVM); + DO_TEST_QEMU("2.12.0", "x86_64"); + DO_TEST_QEMU("2.12.0", "aarch64"); + DO_TEST_QEMU("2.12.0", "ppc64"); + DO_TEST_QEMU("2.12.0", "s390x"); - DO_TEST_QEMU("3.0.0", NULL, "s390x", VIR_DOMAIN_VIRT_KVM); + DO_TEST_QEMU("3.0.0", "s390x"); - DO_TEST_QEMU("3.1.0", NULL, "x86_64", VIR_DOMAIN_VIRT_KVM); + DO_TEST_QEMU("3.1.0", "x86_64"); - DO_TEST_QEMU("4.0.0", NULL, "x86_64", VIR_DOMAIN_VIRT_KVM); - DO_TEST_QEMU("4.0.0", NULL, "s390x", VIR_DOMAIN_VIRT_KVM); + DO_TEST_QEMU("4.0.0", "x86_64"); + DO_TEST_QEMU("4.0.0", "s390x"); - DO_TEST_QEMU("4.1.0", NULL, "x86_64", VIR_DOMAIN_VIRT_KVM); + DO_TEST_QEMU("4.1.0", "x86_64"); - DO_TEST_QEMU("4.2.0", NULL, "x86_64", VIR_DOMAIN_VIRT_KVM); - DO_TEST_QEMU("4.2.0", NULL, "ppc64", VIR_DOMAIN_VIRT_KVM); - DO_TEST_QEMU("4.2.0", NULL, "aarch64", VIR_DOMAIN_VIRT_KVM); + DO_TEST_QEMU("4.2.0", "x86_64"); + DO_TEST_QEMU("4.2.0", "ppc64"); + DO_TEST_QEMU("4.2.0", "aarch64"); virObjectUnref(cfg); -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list