[v2,03/16] tests: domcaps: Remove 'full' test

Message ID 3e1a0a53d59172fa656e07f28c9232cf69d1e67b.1551914794.git.crobinso@redhat.com
State New
Headers show
Series
  • domcaps: use virTristateBool
Related show

Commit Message

Cole Robinson March 6, 2019, 11:36 p.m.
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

Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 tests/domaincapsschemadata/full.xml | 123 ----------------------------
 tests/domaincapstest.c              |  73 -----------------
 2 files changed, 196 deletions(-)
 delete mode 100644 tests/domaincapsschemadata/full.xml

-- 
2.20.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Patch

diff --git a/tests/domaincapsschemadata/full.xml b/tests/domaincapsschemadata/full.xml
deleted file mode 100644
index 28263466a4..0000000000
--- a/tests/domaincapsschemadata/full.xml
+++ /dev/null
@@ -1,123 +0,0 @@ 
-<domainCapabilities>
-  <path>/bin/emulatorbin</path>
-  <domain>kvm</domain>
-  <machine>my-machine-type</machine>
-  <arch>x86_64</arch>
-  <vcpu max='255'/>
-  <iothreads supported='no'/>
-  <os supported='yes'>
-    <loader supported='yes'>
-      <value>/foo/bar</value>
-      <value>/tmp/my_path</value>
-      <enum name='type'>
-        <value>rom</value>
-        <value>pflash</value>
-      </enum>
-      <enum name='readonly'>
-        <value>default</value>
-        <value>yes</value>
-        <value>no</value>
-      </enum>
-    </loader>
-  </os>
-  <cpu>
-    <mode name='host-passthrough' supported='yes'/>
-    <mode name='host-model' supported='yes'>
-      <model>host</model>
-      <vendor>CPU Vendorrr</vendor>
-    </mode>
-    <mode name='custom' supported='yes'>
-      <model usable='unknown'>Model1</model>
-      <model usable='no'>Model2</model>
-      <model usable='yes'>Model3</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>ide</value>
-        <value>fdc</value>
-        <value>scsi</value>
-        <value>virtio</value>
-        <value>xen</value>
-        <value>usb</value>
-        <value>uml</value>
-        <value>sata</value>
-        <value>sd</value>
-      </enum>
-      <enum name='model'>
-        <value>default</value>
-        <value>virtio</value>
-        <value>virtio-transitional</value>
-        <value>virtio-non-transitional</value>
-      </enum>
-    </disk>
-    <graphics supported='yes'>
-      <enum name='type'>
-        <value>sdl</value>
-        <value>vnc</value>
-        <value>rdp</value>
-        <value>desktop</value>
-        <value>spice</value>
-        <value>egl-headless</value>
-      </enum>
-    </graphics>
-    <video supported='yes'>
-      <enum name='modelType'>
-        <value>default</value>
-        <value>vga</value>
-        <value>cirrus</value>
-        <value>vmvga</value>
-        <value>xen</value>
-        <value>vbox</value>
-        <value>qxl</value>
-        <value>parallels</value>
-        <value>virtio</value>
-        <value>gop</value>
-        <value>none</value>
-      </enum>
-    </video>
-    <hostdev supported='yes'>
-      <enum name='mode'>
-        <value>subsystem</value>
-        <value>capabilities</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>
-        <value>scsi_host</value>
-        <value>mdev</value>
-      </enum>
-      <enum name='capsType'>
-        <value>storage</value>
-        <value>misc</value>
-        <value>net</value>
-      </enum>
-      <enum name='pciBackend'>
-        <value>default</value>
-        <value>kvm</value>
-        <value>vfio</value>
-        <value>xen</value>
-      </enum>
-    </hostdev>
-  </devices>
-  <features>
-    <gic supported='no'/>
-    <vmcoreinfo supported='no'/>
-    <genid supported='no'/>
-    <sev supported='no'/>
-  </features>
-</domainCapabilities>
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; \