[libvirt] [PATCH v2 0/6] tests: qemuxml2xml: add DO_TEST_CAPS*

v1: https://www.redhat.com/archives/libvir-list/2019-April/msg00083.html v2 changes: - Push first series prep work - Split last patch into multiple pieces - Add genid* conversion to demonstrate -active and -inactive names - Address Andrea's review comments Cole Robinson (6): tests: qemuxml2xml: Set name in testQemuInfo tests: qemuxml2xml: Add DO_TEST_CAPS* tests: qemuxml2xml: Convert virtio-*transitional to TEST_CAPS tests: qemuxml2xml: Convert os-firmware* to TEST_CAPS tests: qemuxml2xml: Convert genid* to TEST_CAPS tests: qemuxml2xml: Convert aarch64-os-firmware-efi to TEST_CAPS ...aarch64-os-firmware-efi.aarch64-latest.xml | 31 ++++ .../aarch64-os-firmware-efi.xml | 1 - ...ive.xml => genid-active.x86_64-latest.xml} | 2 +- ...ml => genid-auto-active.x86_64-latest.xml} | 2 +- ... => genid-auto-inactive.x86_64-latest.xml} | 2 +- ...e.xml => genid-inactive.x86_64-latest.xml} | 2 +- .../os-firmware-bios.x86_64-latest.xml | 68 +++++++++ tests/qemuxml2xmloutdata/os-firmware-bios.xml | 1 - .../os-firmware-efi-secboot.x86_64-latest.xml | 68 +++++++++ .../os-firmware-efi-secboot.xml | 1 - .../os-firmware-efi.x86_64-latest.xml | 68 +++++++++ tests/qemuxml2xmloutdata/os-firmware-efi.xml | 1 - ...virtio-non-transitional.x86_64-latest.xml} | 0 ... => virtio-transitional.x86_64-latest.xml} | 0 tests/qemuxml2xmltest.c | 132 ++++++++---------- 15 files changed, 299 insertions(+), 80 deletions(-) create mode 100644 tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.aarch64-latest.xml delete mode 120000 tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.xml rename tests/qemuxml2xmloutdata/{genid-active.xml => genid-active.x86_64-latest.xml} (94%) rename tests/qemuxml2xmloutdata/{genid-auto-active.xml => genid-auto-active.x86_64-latest.xml} (94%) rename tests/qemuxml2xmloutdata/{genid-auto-inactive.xml => genid-auto-inactive.x86_64-latest.xml} (94%) rename tests/qemuxml2xmloutdata/{genid-inactive.xml => genid-inactive.x86_64-latest.xml} (94%) create mode 100644 tests/qemuxml2xmloutdata/os-firmware-bios.x86_64-latest.xml delete mode 120000 tests/qemuxml2xmloutdata/os-firmware-bios.xml create mode 100644 tests/qemuxml2xmloutdata/os-firmware-efi-secboot.x86_64-latest.xml delete mode 120000 tests/qemuxml2xmloutdata/os-firmware-efi-secboot.xml create mode 100644 tests/qemuxml2xmloutdata/os-firmware-efi.x86_64-latest.xml delete mode 120000 tests/qemuxml2xmloutdata/os-firmware-efi.xml rename tests/qemuxml2xmloutdata/{virtio-non-transitional.xml => virtio-non-transitional.x86_64-latest.xml} (100%) rename tests/qemuxml2xmloutdata/{virtio-transitional.xml => virtio-transitional.x86_64-latest.xml} (100%) -- 2.21.0

Use the same pattern that is used in qemuxml2argvtest, setting the name in a static testQemuInfo instance inside the test macros Signed-off-by: Cole Robinson <crobinso@redhat.com> --- tests/qemuxml2xmltest.c | 47 +++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 8a7a56f764..59c0c2c483 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -90,19 +90,18 @@ testCompareStatusXMLToXMLFiles(const void *opaque) static int testInfoSetPaths(struct testQemuInfo *info, - const char *name, int when) { VIR_FREE(info->infile); VIR_FREE(info->outfile); if (virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml", - abs_srcdir, name) < 0) + abs_srcdir, info->name) < 0) goto error; if (virAsprintf(&info->outfile, "%s/qemuxml2xmloutdata/%s-%s.xml", - abs_srcdir, name, + abs_srcdir, info->name, when == WHEN_ACTIVE ? "active" : "inactive") < 0) goto error; @@ -111,7 +110,7 @@ testInfoSetPaths(struct testQemuInfo *info, if (virAsprintf(&info->outfile, "%s/qemuxml2xmloutdata/%s.xml", - abs_srcdir, name) < 0) + abs_srcdir, info->name) < 0) goto error; } @@ -126,11 +125,10 @@ testInfoSetPaths(struct testQemuInfo *info, static const char *statusPath = abs_srcdir "/qemustatusxml2xmldata/"; static int -testInfoSetStatusPaths(struct testQemuInfo *info, - const char *name) +testInfoSetStatusPaths(struct testQemuInfo *info) { - if (virAsprintf(&info->infile, "%s%s-in.xml", statusPath, name) < 0 || - virAsprintf(&info->outfile, "%s%s-out.xml", statusPath, name) < 0) + if (virAsprintf(&info->infile, "%s%s-in.xml", statusPath, info->name) < 0 || + virAsprintf(&info->outfile, "%s%s-out.xml", statusPath, info->name) < 0) goto error; return 0; @@ -148,7 +146,6 @@ mymain(void) { int ret = 0; char *fakerootdir; - struct testQemuInfo info; virQEMUDriverConfigPtr cfg = NULL; virHashTablePtr capslatest = NULL; @@ -168,39 +165,40 @@ mymain(void) setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, 1); - memset(&info, 0, sizeof(info)); - if (qemuTestDriverInit(&driver) < 0) return EXIT_FAILURE; cfg = virQEMUDriverGetConfig(&driver); -# define DO_TEST_FULL(name, when, ...) \ +# define DO_TEST_FULL(_name, when, ...) \ do { \ + static struct testQemuInfo info = { \ + .name = _name, \ + }; \ if (testQemuInfoSetArgs(&info, capslatest, \ __VA_ARGS__, \ ARG_END) < 0 || \ qemuTestCapsCacheInsert(driver.qemuCapsCache, info.qemuCaps) < 0) { \ - VIR_TEST_DEBUG("Failed to generate test data for '%s'", name); \ + VIR_TEST_DEBUG("Failed to generate test data for '%s'", _name); \ return -1; \ } \ \ if (when & WHEN_INACTIVE) { \ - if (testInfoSetPaths(&info, name, WHEN_INACTIVE) < 0) { \ - VIR_TEST_DEBUG("Failed to generate inactive paths for '%s'", name); \ + if (testInfoSetPaths(&info, WHEN_INACTIVE) < 0) { \ + VIR_TEST_DEBUG("Failed to generate inactive paths for '%s'", _name); \ return -1; \ } \ - if (virTestRun("QEMU XML-2-XML-inactive " name, \ + if (virTestRun("QEMU XML-2-XML-inactive " _name, \ testXML2XMLInactive, &info) < 0) \ ret = -1; \ } \ \ if (when & WHEN_ACTIVE) { \ - if (testInfoSetPaths(&info, name, WHEN_ACTIVE) < 0) { \ - VIR_TEST_DEBUG("Failed to generate active paths for '%s'", name); \ + if (testInfoSetPaths(&info, WHEN_ACTIVE) < 0) { \ + VIR_TEST_DEBUG("Failed to generate active paths for '%s'", _name); \ return -1; \ } \ - if (virTestRun("QEMU XML-2-XML-active " name, \ + if (virTestRun("QEMU XML-2-XML-active " _name, \ testXML2XMLActive, &info) < 0) \ ret = -1; \ } \ @@ -1253,18 +1251,21 @@ mymain(void) QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_MCH_EXTENDED_TSEG_MBYTES); -# define DO_TEST_STATUS(name) \ +# define DO_TEST_STATUS(_name) \ do { \ + static struct testQemuInfo info = { \ + .name = _name, \ + }; \ if (testQemuInfoSetArgs(&info, capslatest, \ ARG_QEMU_CAPS, QEMU_CAPS_LAST, \ ARG_END) < 0 || \ qemuTestCapsCacheInsert(driver.qemuCapsCache, info.qemuCaps) < 0 || \ - testInfoSetStatusPaths(&info, name) < 0) { \ - VIR_TEST_DEBUG("Failed to generate status test data for '%s'", name); \ + testInfoSetStatusPaths(&info) < 0) { \ + VIR_TEST_DEBUG("Failed to generate status test data for '%s'", _name); \ return -1; \ } \ \ - if (virTestRun("QEMU status XML-2-XML " name, \ + if (virTestRun("QEMU status XML-2-XML " _name, \ testCompareStatusXMLToXMLFiles, &info) < 0) \ ret = -1; \ \ -- 2.21.0

On Mon, 2019-04-15 at 19:09 -0400, Cole Robinson wrote: [...]
@@ -148,7 +146,6 @@ mymain(void) { int ret = 0; char *fakerootdir; - struct testQemuInfo info; virQEMUDriverConfigPtr cfg = NULL; virHashTablePtr capslatest = NULL;
@@ -168,39 +165,40 @@ mymain(void)
setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, 1);
- memset(&info, 0, sizeof(info)); - if (qemuTestDriverInit(&driver) < 0) return EXIT_FAILURE;
cfg = virQEMUDriverGetConfig(&driver);
-# define DO_TEST_FULL(name, when, ...) \ +# define DO_TEST_FULL(_name, when, ...) \ do { \ + static struct testQemuInfo info = { \ + .name = _name, \ + }; \
Since we're calling testQemuInfoClear() at the end of the macro already, we could probably avoid creating a new structure every single time and reuse the same one over and over again, as this test was doing. But we can do that in a later patch, and now that the code is identical between xml2argv and xml2xml it's gonna be easier to change both at the same time. Reviewed-by: Andrea Bolognani <abologna@redhat.com> -- Andrea Bolognani / Red Hat / Virtualization

Add DO_TEST_CAPS* macros, lifted from qemuxml2argvtest. Signed-off-by: Cole Robinson <crobinso@redhat.com> --- tests/qemuxml2xmltest.c | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 59c0c2c483..aac050f559 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -90,6 +90,7 @@ testCompareStatusXMLToXMLFiles(const void *opaque) static int testInfoSetPaths(struct testQemuInfo *info, + const char *suffix, int when) { VIR_FREE(info->infile); @@ -100,17 +101,18 @@ testInfoSetPaths(struct testQemuInfo *info, goto error; if (virAsprintf(&info->outfile, - "%s/qemuxml2xmloutdata/%s-%s.xml", + "%s/qemuxml2xmloutdata/%s-%s%s.xml", abs_srcdir, info->name, - when == WHEN_ACTIVE ? "active" : "inactive") < 0) + when == WHEN_ACTIVE ? "active" : "inactive", + suffix) < 0) goto error; if (!virFileExists(info->outfile)) { VIR_FREE(info->outfile); if (virAsprintf(&info->outfile, - "%s/qemuxml2xmloutdata/%s.xml", - abs_srcdir, info->name) < 0) + "%s/qemuxml2xmloutdata/%s%s.xml", + abs_srcdir, info->name, suffix) < 0) goto error; } @@ -170,7 +172,7 @@ mymain(void) cfg = virQEMUDriverGetConfig(&driver); -# define DO_TEST_FULL(_name, when, ...) \ +# define DO_TEST_INTERNAL(_name, suffix, when, ...) \ do { \ static struct testQemuInfo info = { \ .name = _name, \ @@ -184,7 +186,7 @@ mymain(void) } \ \ if (when & WHEN_INACTIVE) { \ - if (testInfoSetPaths(&info, WHEN_INACTIVE) < 0) { \ + if (testInfoSetPaths(&info, suffix, WHEN_INACTIVE) < 0) { \ VIR_TEST_DEBUG("Failed to generate inactive paths for '%s'", _name); \ return -1; \ } \ @@ -194,7 +196,7 @@ mymain(void) } \ \ if (when & WHEN_ACTIVE) { \ - if (testInfoSetPaths(&info, WHEN_ACTIVE) < 0) { \ + if (testInfoSetPaths(&info, suffix, WHEN_ACTIVE) < 0) { \ VIR_TEST_DEBUG("Failed to generate active paths for '%s'", _name); \ return -1; \ } \ @@ -207,10 +209,33 @@ mymain(void) # define NONE QEMU_CAPS_LAST +# define DO_TEST_FULL(name, when, ...) \ + DO_TEST_INTERNAL(name, "", when, __VA_ARGS__) + # define DO_TEST(name, ...) \ DO_TEST_FULL(name, WHEN_BOTH, \ ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST) +# define DO_TEST_CAPS_INTERNAL(name, arch, ver, ...) \ + DO_TEST_INTERNAL(name, "." arch "-" ver, WHEN_BOTH, \ + ARG_CAPS_ARCH, arch, \ + ARG_CAPS_VER, ver, \ + __VA_ARGS__) + +# define DO_TEST_CAPS_ARCH_VER(name, arch, ver) \ + DO_TEST_CAPS_INTERNAL(name, arch, ver, ARG_END) + +# define DO_TEST_CAPS_VER(name, ver) \ + DO_TEST_CAPS_ARCH_VER(name, "x86_64", ver) + +# define DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ...) \ + DO_TEST_CAPS_INTERNAL(name, arch, "latest", __VA_ARGS__) + +# define DO_TEST_CAPS_ARCH_LATEST(name, arch) \ + DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ARG_END) + +# define DO_TEST_CAPS_LATEST(name) \ + DO_TEST_CAPS_ARCH_LATEST(name, "x86_64") /* Unset or set all envvars here that are copied in qemudBuildCommandLine -- 2.21.0

On Mon, 2019-04-15 at 19:09 -0400, Cole Robinson wrote:
Add DO_TEST_CAPS* macros, lifted from qemuxml2argvtest.
Signed-off-by: Cole Robinson <crobinso@redhat.com> --- tests/qemuxml2xmltest.c | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-)
Reviewed-by: Andrea Bolognani <abologna@redhat.com> -- Andrea Bolognani / Red Hat / Virtualization

Convert these test cases to use DO_TEST_CAPS_LATEST * virtio-transitional * virtio-non-transitional Signed-off-by: Cole Robinson <crobinso@redhat.com> --- ...virtio-non-transitional.x86_64-latest.xml} | 0 ... => virtio-transitional.x86_64-latest.xml} | 0 tests/qemuxml2xmltest.c | 20 ++----------------- 3 files changed, 2 insertions(+), 18 deletions(-) rename tests/qemuxml2xmloutdata/{virtio-non-transitional.xml => virtio-non-transitional.x86_64-latest.xml} (100%) rename tests/qemuxml2xmloutdata/{virtio-transitional.xml => virtio-transitional.x86_64-latest.xml} (100%) diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/qemuxml2xmloutdata/virtio-non-transitional.x86_64-latest.xml similarity index 100% rename from tests/qemuxml2xmloutdata/virtio-non-transitional.xml rename to tests/qemuxml2xmloutdata/virtio-non-transitional.x86_64-latest.xml diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.x86_64-latest.xml similarity index 100% rename from tests/qemuxml2xmloutdata/virtio-transitional.xml rename to tests/qemuxml2xmloutdata/virtio-transitional.x86_64-latest.xml diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index aac050f559..20aaa1b9f5 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1319,24 +1319,8 @@ mymain(void) DO_TEST("riscv64-virt-pci", QEMU_CAPS_OBJECT_GPEX); - DO_TEST("virtio-transitional", - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, - QEMU_CAPS_DEVICE_VIRTIO_RNG, - QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY, - QEMU_CAPS_DEVICE_VHOST_VSOCK, - QEMU_CAPS_VIRTIO_INPUT_HOST, - QEMU_CAPS_VIRTIO_SCSI); - DO_TEST("virtio-non-transitional", - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, - QEMU_CAPS_DEVICE_VIRTIO_RNG, - QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY, - QEMU_CAPS_DEVICE_VHOST_VSOCK, - QEMU_CAPS_VIRTIO_INPUT_HOST, - QEMU_CAPS_VIRTIO_SCSI); + DO_TEST_CAPS_LATEST("virtio-transitional"); + DO_TEST_CAPS_LATEST("virtio-non-transitional"); if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL) virFileDeleteTree(fakerootdir); -- 2.21.0

On Mon, 2019-04-15 at 19:09 -0400, Cole Robinson wrote: [...]
+ DO_TEST_CAPS_LATEST("virtio-transitional"); + DO_TEST_CAPS_LATEST("virtio-non-transitional");
We should also add DO_TEST_CAPS_VER("virtio-transitional", "3.1.0"); DO_TEST_CAPS_VER("virtio-non-transitional", "3.1.0"); same as xml2argv. You can do that in a separate patch, though. Reviewed-by: Andrea Bolognani <abologna@redhat.com> -- Andrea Bolognani / Red Hat / Virtualization

On 4/16/19 4:58 AM, Andrea Bolognani wrote:
On Mon, 2019-04-15 at 19:09 -0400, Cole Robinson wrote: [...]
+ DO_TEST_CAPS_LATEST("virtio-transitional"); + DO_TEST_CAPS_LATEST("virtio-non-transitional");
We should also add
DO_TEST_CAPS_VER("virtio-transitional", "3.1.0"); DO_TEST_CAPS_VER("virtio-non-transitional", "3.1.0");
same as xml2argv. You can do that in a separate patch, though.
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Hmm I'm not sure if those bits will actually test any different code paths for xml2xml? I'd check coverage output but lcov is broken with gcc9 on f30 Anyways thanks for the reviews, I've pushed these now Thanks, Cole

On Tue, 2019-04-16 at 12:51 -0400, Cole Robinson wrote:
On 4/16/19 4:58 AM, Andrea Bolognani wrote:
On Mon, 2019-04-15 at 19:09 -0400, Cole Robinson wrote: [...]
+ DO_TEST_CAPS_LATEST("virtio-transitional"); + DO_TEST_CAPS_LATEST("virtio-non-transitional");
We should also add
DO_TEST_CAPS_VER("virtio-transitional", "3.1.0"); DO_TEST_CAPS_VER("virtio-non-transitional", "3.1.0");
same as xml2argv. You can do that in a separate patch, though.
Hmm I'm not sure if those bits will actually test any different code paths for xml2xml? I'd check coverage output but lcov is broken with gcc9 on f30
You're right, the only difference between the output files would be the machine type. Never mind, then :) -- Andrea Bolognani / Red Hat / Virtualization

Convert these test cases to use DO_TEST_CAPS_LATEST * os-firmware-bios * os-firmware-efi * os-firmware-efi-secboot Signed-off-by: Cole Robinson <crobinso@redhat.com> --- .../os-firmware-bios.x86_64-latest.xml | 68 +++++++++++++++++++ tests/qemuxml2xmloutdata/os-firmware-bios.xml | 1 - .../os-firmware-efi-secboot.x86_64-latest.xml | 68 +++++++++++++++++++ .../os-firmware-efi-secboot.xml | 1 - .../os-firmware-efi.x86_64-latest.xml | 68 +++++++++++++++++++ tests/qemuxml2xmloutdata/os-firmware-efi.xml | 1 - tests/qemuxml2xmltest.c | 27 +------- 7 files changed, 207 insertions(+), 27 deletions(-) create mode 100644 tests/qemuxml2xmloutdata/os-firmware-bios.x86_64-latest.xml delete mode 120000 tests/qemuxml2xmloutdata/os-firmware-bios.xml create mode 100644 tests/qemuxml2xmloutdata/os-firmware-efi-secboot.x86_64-latest.xml delete mode 120000 tests/qemuxml2xmloutdata/os-firmware-efi-secboot.xml create mode 100644 tests/qemuxml2xmloutdata/os-firmware-efi.x86_64-latest.xml delete mode 120000 tests/qemuxml2xmloutdata/os-firmware-efi.xml diff --git a/tests/qemuxml2xmloutdata/os-firmware-bios.x86_64-latest.xml b/tests/qemuxml2xmloutdata/os-firmware-bios.x86_64-latest.xml new file mode 100644 index 0000000000..63886666dd --- /dev/null +++ b/tests/qemuxml2xmloutdata/os-firmware-bios.x86_64-latest.xml @@ -0,0 +1,68 @@ +<domain type='kvm'> + <name>fedora</name> + <uuid>63840878-0deb-4095-97e6-fc444d9bc9fa</uuid> + <memory unit='KiB'>8192</memory> + <currentMemory unit='KiB'>8192</currentMemory> + <vcpu placement='static'>1</vcpu> + <os firmware='bios'> + <type arch='x86_64' machine='pc-q35-4.0'>hvm</type> + <loader secure='no'/> + <nvram>/var/lib/libvirt/qemu/nvram/fedora_VARS.fd</nvram> + <boot dev='hd'/> + <bootmenu enable='yes'/> + </os> + <features> + <acpi/> + <apic/> + <pae/> + </features> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>restart</on_crash> + <pm> + <suspend-to-mem enabled='yes'/> + <suspend-to-disk enabled='no'/> + </pm> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='usb' index='0' model='ich9-ehci1'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x7'/> + </controller> + <controller type='usb' index='0' model='ich9-uhci1'> + <master startport='0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x0' multifunction='on'/> + </controller> + <controller type='usb' index='0' model='ich9-uhci2'> + <master startport='2'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x1'/> + </controller> + <controller type='usb' index='0' model='ich9-uhci3'> + <master startport='4'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x2'/> + </controller> + <controller type='sata' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/> + </controller> + <controller type='pci' index='0' model='pcie-root'/> + <controller type='pci' index='1' model='dmi-to-pci-bridge'> + <model name='i82801b11-bridge'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/> + </controller> + <controller type='pci' index='2' model='pci-bridge'> + <model name='pci-bridge'/> + <target chassisNr='2'/> + <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/> + </controller> + <controller type='pci' index='3' model='pcie-root-port'> + <model name='ioh3420'/> + <target chassis='3' port='0x8'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/os-firmware-bios.xml b/tests/qemuxml2xmloutdata/os-firmware-bios.xml deleted file mode 120000 index 3d36d5df68..0000000000 --- a/tests/qemuxml2xmloutdata/os-firmware-bios.xml +++ /dev/null @@ -1 +0,0 @@ -../qemuxml2argvdata/os-firmware-bios.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.x86_64-latest.xml b/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.x86_64-latest.xml new file mode 100644 index 0000000000..a285e06334 --- /dev/null +++ b/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.x86_64-latest.xml @@ -0,0 +1,68 @@ +<domain type='kvm'> + <name>fedora</name> + <uuid>63840878-0deb-4095-97e6-fc444d9bc9fa</uuid> + <memory unit='KiB'>8192</memory> + <currentMemory unit='KiB'>8192</currentMemory> + <vcpu placement='static'>1</vcpu> + <os firmware='efi'> + <type arch='x86_64' machine='pc-q35-4.0'>hvm</type> + <loader secure='yes'/> + <nvram>/var/lib/libvirt/qemu/nvram/fedora_VARS.fd</nvram> + <boot dev='hd'/> + <bootmenu enable='yes'/> + </os> + <features> + <acpi/> + <apic/> + <pae/> + </features> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>restart</on_crash> + <pm> + <suspend-to-mem enabled='yes'/> + <suspend-to-disk enabled='no'/> + </pm> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='usb' index='0' model='ich9-ehci1'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x7'/> + </controller> + <controller type='usb' index='0' model='ich9-uhci1'> + <master startport='0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x0' multifunction='on'/> + </controller> + <controller type='usb' index='0' model='ich9-uhci2'> + <master startport='2'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x1'/> + </controller> + <controller type='usb' index='0' model='ich9-uhci3'> + <master startport='4'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x2'/> + </controller> + <controller type='sata' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/> + </controller> + <controller type='pci' index='0' model='pcie-root'/> + <controller type='pci' index='1' model='dmi-to-pci-bridge'> + <model name='i82801b11-bridge'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/> + </controller> + <controller type='pci' index='2' model='pci-bridge'> + <model name='pci-bridge'/> + <target chassisNr='2'/> + <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/> + </controller> + <controller type='pci' index='3' model='pcie-root-port'> + <model name='ioh3420'/> + <target chassis='3' port='0x8'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.xml b/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.xml deleted file mode 120000 index 93e184e2d2..0000000000 --- a/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.xml +++ /dev/null @@ -1 +0,0 @@ -../qemuxml2argvdata/os-firmware-efi-secboot.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/os-firmware-efi.x86_64-latest.xml b/tests/qemuxml2xmloutdata/os-firmware-efi.x86_64-latest.xml new file mode 100644 index 0000000000..46a7b1b780 --- /dev/null +++ b/tests/qemuxml2xmloutdata/os-firmware-efi.x86_64-latest.xml @@ -0,0 +1,68 @@ +<domain type='kvm'> + <name>fedora</name> + <uuid>63840878-0deb-4095-97e6-fc444d9bc9fa</uuid> + <memory unit='KiB'>8192</memory> + <currentMemory unit='KiB'>8192</currentMemory> + <vcpu placement='static'>1</vcpu> + <os firmware='efi'> + <type arch='x86_64' machine='pc-q35-4.0'>hvm</type> + <loader secure='no'/> + <nvram>/var/lib/libvirt/qemu/nvram/fedora_VARS.fd</nvram> + <boot dev='hd'/> + <bootmenu enable='yes'/> + </os> + <features> + <acpi/> + <apic/> + <pae/> + </features> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>restart</on_crash> + <pm> + <suspend-to-mem enabled='yes'/> + <suspend-to-disk enabled='no'/> + </pm> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='usb' index='0' model='ich9-ehci1'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x7'/> + </controller> + <controller type='usb' index='0' model='ich9-uhci1'> + <master startport='0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x0' multifunction='on'/> + </controller> + <controller type='usb' index='0' model='ich9-uhci2'> + <master startport='2'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x1'/> + </controller> + <controller type='usb' index='0' model='ich9-uhci3'> + <master startport='4'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x2'/> + </controller> + <controller type='sata' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/> + </controller> + <controller type='pci' index='0' model='pcie-root'/> + <controller type='pci' index='1' model='dmi-to-pci-bridge'> + <model name='i82801b11-bridge'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/> + </controller> + <controller type='pci' index='2' model='pci-bridge'> + <model name='pci-bridge'/> + <target chassisNr='2'/> + <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/> + </controller> + <controller type='pci' index='3' model='pcie-root-port'> + <model name='ioh3420'/> + <target chassis='3' port='0x8'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/os-firmware-efi.xml b/tests/qemuxml2xmloutdata/os-firmware-efi.xml deleted file mode 120000 index 15cfad1ea0..0000000000 --- a/tests/qemuxml2xmloutdata/os-firmware-efi.xml +++ /dev/null @@ -1 +0,0 @@ -../qemuxml2argvdata/os-firmware-efi.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 20aaa1b9f5..1d232185ec 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1003,30 +1003,9 @@ mymain(void) DO_TEST("smbios", NONE); DO_TEST("smbios-multiple-type2", NONE); - DO_TEST("os-firmware-bios", - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_DEVICE_IOH3420, - QEMU_CAPS_ICH9_AHCI, - QEMU_CAPS_ICH9_USB_EHCI1, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_DEVICE_QXL); - DO_TEST("os-firmware-efi", - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_DEVICE_IOH3420, - QEMU_CAPS_ICH9_AHCI, - QEMU_CAPS_ICH9_USB_EHCI1, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_DEVICE_QXL); - DO_TEST("os-firmware-efi-secboot", - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_DEVICE_IOH3420, - QEMU_CAPS_ICH9_AHCI, - QEMU_CAPS_ICH9_USB_EHCI1, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_DEVICE_QXL); + DO_TEST_CAPS_LATEST("os-firmware-bios"); + DO_TEST_CAPS_LATEST("os-firmware-efi"); + DO_TEST_CAPS_LATEST("os-firmware-efi-secboot"); DO_TEST("aarch64-aavmf-virtio-mmio", QEMU_CAPS_DEVICE_VIRTIO_MMIO, -- 2.21.0

On Mon, 2019-04-15 at 19:09 -0400, Cole Robinson wrote:
Convert these test cases to use DO_TEST_CAPS_LATEST
* os-firmware-bios * os-firmware-efi * os-firmware-efi-secboot
Signed-off-by: Cole Robinson <crobinso@redhat.com> --- .../os-firmware-bios.x86_64-latest.xml | 68 +++++++++++++++++++ tests/qemuxml2xmloutdata/os-firmware-bios.xml | 1 - .../os-firmware-efi-secboot.x86_64-latest.xml | 68 +++++++++++++++++++ .../os-firmware-efi-secboot.xml | 1 - .../os-firmware-efi.x86_64-latest.xml | 68 +++++++++++++++++++ tests/qemuxml2xmloutdata/os-firmware-efi.xml | 1 - tests/qemuxml2xmltest.c | 27 +------- 7 files changed, 207 insertions(+), 27 deletions(-) create mode 100644 tests/qemuxml2xmloutdata/os-firmware-bios.x86_64-latest.xml delete mode 120000 tests/qemuxml2xmloutdata/os-firmware-bios.xml create mode 100644 tests/qemuxml2xmloutdata/os-firmware-efi-secboot.x86_64-latest.xml delete mode 120000 tests/qemuxml2xmloutdata/os-firmware-efi-secboot.xml create mode 100644 tests/qemuxml2xmloutdata/os-firmware-efi.x86_64-latest.xml delete mode 120000 tests/qemuxml2xmloutdata/os-firmware-efi.xml
Not obvious from the diff, but I've verified manually that the new output files are identical to the old ones. [...]
+ DO_TEST_CAPS_LATEST("os-firmware-bios"); + DO_TEST_CAPS_LATEST("os-firmware-efi"); + DO_TEST_CAPS_LATEST("os-firmware-efi-secboot");
Again, we should add DO_TEST_CAPS_ARCH_LATEST("aarch64-os-firmware-efi", "aarch64"); too. Can, and perhaps should, be done in a separate patch. Reviewed-by: Andrea Bolognani <abologna@redhat.com> -- Andrea Bolognani / Red Hat / Virtualization

Convert these test cases to use DO_TEST_CAPS_LATEST * genid * genid-auto This ensures the test infrastructure is working as expected for a test case with explicit -active and -inactive XML test data Signed-off-by: Cole Robinson <crobinso@redhat.com> --- .../{genid-active.xml => genid-active.x86_64-latest.xml} | 2 +- ...id-auto-active.xml => genid-auto-active.x86_64-latest.xml} | 2 +- ...uto-inactive.xml => genid-auto-inactive.x86_64-latest.xml} | 2 +- .../{genid-inactive.xml => genid-inactive.x86_64-latest.xml} | 2 +- tests/qemuxml2xmltest.c | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) rename tests/qemuxml2xmloutdata/{genid-active.xml => genid-active.x86_64-latest.xml} (94%) rename tests/qemuxml2xmloutdata/{genid-auto-active.xml => genid-auto-active.x86_64-latest.xml} (94%) rename tests/qemuxml2xmloutdata/{genid-auto-inactive.xml => genid-auto-inactive.x86_64-latest.xml} (94%) rename tests/qemuxml2xmloutdata/{genid-inactive.xml => genid-inactive.x86_64-latest.xml} (94%) diff --git a/tests/qemuxml2xmloutdata/genid-active.xml b/tests/qemuxml2xmloutdata/genid-active.x86_64-latest.xml similarity index 94% rename from tests/qemuxml2xmloutdata/genid-active.xml rename to tests/qemuxml2xmloutdata/genid-active.x86_64-latest.xml index fc41f2dd28..28390e51a6 100644 --- a/tests/qemuxml2xmloutdata/genid-active.xml +++ b/tests/qemuxml2xmloutdata/genid-active.x86_64-latest.xml @@ -18,7 +18,7 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> <controller type='ide' index='0'> diff --git a/tests/qemuxml2xmloutdata/genid-auto-active.xml b/tests/qemuxml2xmloutdata/genid-auto-active.x86_64-latest.xml similarity index 94% rename from tests/qemuxml2xmloutdata/genid-auto-active.xml rename to tests/qemuxml2xmloutdata/genid-auto-active.x86_64-latest.xml index aeca0d7fc0..e94846f453 100644 --- a/tests/qemuxml2xmloutdata/genid-auto-active.xml +++ b/tests/qemuxml2xmloutdata/genid-auto-active.x86_64-latest.xml @@ -18,7 +18,7 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> <controller type='ide' index='0'> diff --git a/tests/qemuxml2xmloutdata/genid-auto-inactive.xml b/tests/qemuxml2xmloutdata/genid-auto-inactive.x86_64-latest.xml similarity index 94% rename from tests/qemuxml2xmloutdata/genid-auto-inactive.xml rename to tests/qemuxml2xmloutdata/genid-auto-inactive.x86_64-latest.xml index a7b711d469..f8ab86afa0 100644 --- a/tests/qemuxml2xmloutdata/genid-auto-inactive.xml +++ b/tests/qemuxml2xmloutdata/genid-auto-inactive.x86_64-latest.xml @@ -18,7 +18,7 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> <controller type='ide' index='0'> diff --git a/tests/qemuxml2xmloutdata/genid-inactive.xml b/tests/qemuxml2xmloutdata/genid-inactive.x86_64-latest.xml similarity index 94% rename from tests/qemuxml2xmloutdata/genid-inactive.xml rename to tests/qemuxml2xmloutdata/genid-inactive.x86_64-latest.xml index 8bd526a7a9..c0813aa1dc 100644 --- a/tests/qemuxml2xmloutdata/genid-inactive.xml +++ b/tests/qemuxml2xmloutdata/genid-inactive.x86_64-latest.xml @@ -18,7 +18,7 @@ <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> <controller type='ide' index='0'> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 1d232185ec..812f5c7ea0 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -244,8 +244,8 @@ mymain(void) setenv("PATH", "/bin", 1); DO_TEST("minimal", NONE); - DO_TEST("genid", NONE); - DO_TEST("genid-auto", NONE); + DO_TEST_CAPS_LATEST("genid"); + DO_TEST_CAPS_LATEST("genid-auto"); DO_TEST("machine-core-on", NONE); DO_TEST("machine-core-off", NONE); DO_TEST("machine-loadparm-multiple-disks-nets-s390", NONE); -- 2.21.0

On Mon, 2019-04-15 at 19:09 -0400, Cole Robinson wrote:
Convert these test cases to use DO_TEST_CAPS_LATEST
* genid * genid-auto
This ensures the test infrastructure is working as expected for a test case with explicit -active and -inactive XML test data
Signed-off-by: Cole Robinson <crobinso@redhat.com> --- .../{genid-active.xml => genid-active.x86_64-latest.xml} | 2 +- ...id-auto-active.xml => genid-auto-active.x86_64-latest.xml} | 2 +- ...uto-inactive.xml => genid-auto-inactive.x86_64-latest.xml} | 2 +- .../{genid-inactive.xml => genid-inactive.x86_64-latest.xml} | 2 +- tests/qemuxml2xmltest.c | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) rename tests/qemuxml2xmloutdata/{genid-active.xml => genid-active.x86_64-latest.xml} (94%) rename tests/qemuxml2xmloutdata/{genid-auto-active.xml => genid-auto-active.x86_64-latest.xml} (94%) rename tests/qemuxml2xmloutdata/{genid-auto-inactive.xml => genid-auto-inactive.x86_64-latest.xml} (94%) rename tests/qemuxml2xmloutdata/{genid-inactive.xml => genid-inactive.x86_64-latest.xml} (94%)
Reviewed-by: Andrea Bolognani <abologna@redhat.com> -- Andrea Bolognani / Red Hat / Virtualization

Demostrate DO_TEST_CAPS_ARCH_LATEST by converting the test case 'aarch64-os-firmware-efi' Signed-off-by: Cole Robinson <crobinso@redhat.com> --- ...aarch64-os-firmware-efi.aarch64-latest.xml | 31 +++++++++++++++++++ .../aarch64-os-firmware-efi.xml | 1 - tests/qemuxml2xmltest.c | 3 +- 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.aarch64-latest.xml delete mode 120000 tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.xml diff --git a/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.aarch64-latest.xml b/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.aarch64-latest.xml new file mode 100644 index 0000000000..529ce6f3c2 --- /dev/null +++ b/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.aarch64-latest.xml @@ -0,0 +1,31 @@ +<domain type='qemu'> + <name>aarch64test</name> + <uuid>496d7ea8-9739-544b-4ebd-ef08be936e8b</uuid> + <memory unit='KiB'>1048576</memory> + <currentMemory unit='KiB'>1048576</currentMemory> + <vcpu placement='static'>1</vcpu> + <os firmware='efi'> + <type arch='aarch64' machine='virt-4.0'>hvm</type> + <kernel>/aarch64.kernel</kernel> + <initrd>/aarch64.initrd</initrd> + <cmdline>earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait</cmdline> + <dtb>/aarch64.dtb</dtb> + <boot dev='hd'/> + </os> + <features> + <apic/> + <pae/> + <gic version='2'/> + </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='allow'>cortex-a53</model> + </cpu> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>restart</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-aarch64</emulator> + <controller type='pci' index='0' model='pcie-root'/> + </devices> +</domain> diff --git a/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.xml b/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.xml deleted file mode 120000 index beea6b2955..0000000000 --- a/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.xml +++ /dev/null @@ -1 +0,0 @@ -../qemuxml2argvdata/aarch64-os-firmware-efi.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 812f5c7ea0..8e85710d45 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1010,8 +1010,7 @@ mymain(void) DO_TEST("aarch64-aavmf-virtio-mmio", QEMU_CAPS_DEVICE_VIRTIO_MMIO, QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM); - DO_TEST("aarch64-os-firmware-efi", - QEMU_CAPS_DEVICE_VIRTIO_MMIO); + DO_TEST_CAPS_ARCH_LATEST("aarch64-os-firmware-efi", "aarch64"); DO_TEST("aarch64-virtio-pci-default", QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY, QEMU_CAPS_DEVICE_VIRTIO_MMIO, -- 2.21.0

On Mon, 2019-04-15 at 19:09 -0400, Cole Robinson wrote: [...]
+ DO_TEST_CAPS_ARCH_LATEST("aarch64-os-firmware-efi", "aarch64");
Welp, I see you've taken my comments from 4/6 to heart and implemented them *in the past*! :) I would move this right after the other os-firmware-* tests to match the grouping seen in xml2argv. With that changed, Reviewed-by: Andrea Bolognani <abologna@redhat.com> -- Andrea Bolognani / Red Hat / Virtualization
participants (2)
-
Andrea Bolognani
-
Cole Robinson