[03/10] tests: domcaps: Remove 'full' test

Message ID 4e6a3e7dc40aeda6f6e57d97d961546eabe9e1f5.1550606392.git.crobinso@redhat.com
State New
Headers show
Series
  • domcaps: use virTristateBool
Related show

Commit Message

Cole Robinson Feb. 19, 2019, 8:09 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/domaincapstest.c | 72 ------------------------------------------
 1 file changed, 72 deletions(-)

-- 
2.20.1

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

Patch

diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c
index 07ed8b750e..3afa84b42e 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,66 +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);
-
-    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"
@@ -257,7 +194,6 @@  fillBhyveCaps(virDomainCapsPtr domCaps, unsigned int *bhyve_caps)
 
 enum testCapsType {
     CAPS_NONE,
-    CAPS_ALL,
     CAPS_QEMU,
     CAPS_LIBXL,
     CAPS_BHYVE,
@@ -296,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,
@@ -406,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; \