From ad129324814dd4fc4804e2c3744bed0b877a020a Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Tue, 19 Feb 2019 12:52:30 -0500 Subject: [PATCH] tests: domcaps: Remove 'full' test The 'full' test verifies the output of a virDomainCapsPtr built by hand. It has the following problems: The domcaps test suite nowadays has 3 hypervisor driver implementations which should give us plenty of opportunity to get full domcaps coverage. I don't think this test has much value. And it has the following issues: - Requires manual intervention to test new domcaps XML, which is easy to miss, for example gic bits aren't covered there. - The SET_ALL_BITS trick it uses to fill in enums will output values that are never reported by any driver implementation (strings like 'default') Let's remove it Acked-by: Michal Privoznik Signed-off-by: Cole Robinson --- tests/domaincapsschemadata/full.xml | 124 ---------------------------- tests/domaincapstest.c | 73 ---------------- 2 files changed, 197 deletions(-) delete mode 100644 tests/domaincapsschemadata/full.xml diff --git a/tests/domaincapsschemadata/full.xml b/tests/domaincapsschemadata/full.xml deleted file mode 100644 index 74bc740e0d..0000000000 --- a/tests/domaincapsschemadata/full.xml +++ /dev/null @@ -1,124 +0,0 @@ - - /bin/emulatorbin - kvm - my-machine-type - x86_64 - - - - - /foo/bar - /tmp/my_path - - none - rom - pflash - - - default - yes - no - - - - - - - host - CPU Vendorrr - - - Model1 - Model2 - Model3 - - - - - - disk - cdrom - floppy - lun - - - ide - fdc - scsi - virtio - xen - usb - uml - sata - sd - - - default - virtio - virtio-transitional - virtio-non-transitional - - - - - sdl - vnc - rdp - desktop - spice - egl-headless - - - - - - subsystem - capabilities - - - default - mandatory - requisite - optional - - - usb - pci - scsi - scsi_host - mdev - - - storage - misc - net - - - default - kvm - vfio - xen - - - - - - - - - - diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c index 02f33d9f00..1aa8c023a2 100644 --- a/tests/domaincapstest.c +++ b/tests/domaincapstest.c @@ -24,9 +24,6 @@ #define VIR_FROM_THIS VIR_FROM_NONE -#define SET_ALL_BITS(x) \ - memset(&(x.values), 0xff, sizeof(x.values)) - static int ATTRIBUTE_SENTINEL fillStringValues(virDomainCapsStringValuesPtr values, ...) { @@ -48,67 +45,6 @@ fillStringValues(virDomainCapsStringValuesPtr values, ...) return ret; } -static int -fillAllCaps(virDomainCapsPtr domCaps) -{ - virDomainCapsOSPtr os = &domCaps->os; - virDomainCapsLoaderPtr loader = &os->loader; - virDomainCapsCPUPtr cpu = &domCaps->cpu; - virDomainCapsDeviceDiskPtr disk = &domCaps->disk; - virDomainCapsDeviceGraphicsPtr graphics = &domCaps->graphics; - virDomainCapsDeviceVideoPtr video = &domCaps->video; - virDomainCapsDeviceHostdevPtr hostdev = &domCaps->hostdev; - virCPUDef host = { - .type = VIR_CPU_TYPE_HOST, - .arch = VIR_ARCH_X86_64, - .model = (char *) "host", - .vendor = (char *) "CPU Vendorrr", - }; - - domCaps->maxvcpus = 255; - os->supported = true; - - loader->supported = true; - SET_ALL_BITS(loader->type); - SET_ALL_BITS(loader->readonly); - if (fillStringValues(&loader->values, - "/foo/bar", - "/tmp/my_path", - NULL) < 0) - return -1; - - cpu->hostPassthrough = true; - cpu->hostModel = virCPUDefCopy(&host); - if (!(cpu->custom = virDomainCapsCPUModelsNew(3)) || - virDomainCapsCPUModelsAdd(cpu->custom, "Model1", -1, - VIR_DOMCAPS_CPU_USABLE_UNKNOWN, NULL) < 0 || - virDomainCapsCPUModelsAdd(cpu->custom, "Model2", -1, - VIR_DOMCAPS_CPU_USABLE_NO, NULL) < 0 || - virDomainCapsCPUModelsAdd(cpu->custom, "Model3", -1, - VIR_DOMCAPS_CPU_USABLE_YES, NULL) < 0) - return -1; - - disk->supported = true; - SET_ALL_BITS(disk->diskDevice); - SET_ALL_BITS(disk->bus); - SET_ALL_BITS(disk->model); - - graphics->supported = true; - SET_ALL_BITS(graphics->type); - - video->supported = true; - SET_ALL_BITS(video->modelType); - - hostdev->supported = true; - SET_ALL_BITS(hostdev->mode); - SET_ALL_BITS(hostdev->startupPolicy); - SET_ALL_BITS(hostdev->subsysType); - SET_ALL_BITS(hostdev->capsType); - SET_ALL_BITS(hostdev->pciBackend); - return 0; -} - - #if WITH_QEMU # include "testutilsqemu.h" # include "testutilshostcpus.h" @@ -258,7 +194,6 @@ fillBhyveCaps(virDomainCapsPtr domCaps, unsigned int *bhyve_caps) enum testCapsType { CAPS_NONE, - CAPS_ALL, CAPS_QEMU, CAPS_LIBXL, CAPS_BHYVE, @@ -297,11 +232,6 @@ test_virDomainCapsFormat(const void *opaque) case CAPS_NONE: break; - case CAPS_ALL: - if (fillAllCaps(domCaps) < 0) - goto cleanup; - break; - case CAPS_QEMU: #if WITH_QEMU if (fillQemuCaps(domCaps, data->capsName, data->arch, data->machine, @@ -407,9 +337,6 @@ mymain(void) ret = -1; \ } while (0) - DO_TEST("full", "/bin/emulatorbin", "my-machine-type", - "x86_64", VIR_DOMAIN_VIRT_KVM, CAPS_ALL); - #define DO_TEST_BHYVE(Name, Emulator, BhyveCaps, Type) \ do { \ char *name = NULL; \