]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: allow setting extra capabilities on top of versioned caps
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 9 Dec 2021 14:57:05 +0000 (09:57 -0500)
committerDaniel P. Berrangé <berrange@redhat.com>
Thu, 16 Dec 2021 18:10:33 +0000 (18:10 +0000)
In the QEMU tests a test can either use an explicitly listed set of
capabilities, or can request those matching a particular QEMU
version. Sometimes it is desirable to be able to list extra caps
on top of those implied by a particular version.

This is useful, for example, when QEMU won't report certain features
unless it was run on particular hardware or kernels, and those were
not used when a caps snapshot was imported to the libvirt source tree.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
tests/testutilsqemu.c

index 7b19575d8b563afab7bd44528a90f75c89ad97b2..7fdb82daecc8ecd5df6b8e253330dd9b7938431a 100644 (file)
@@ -772,11 +772,6 @@ testQemuInfoInitArgs(struct testQemuInfo *info)
         bool stripmachinealiases = false;
         virQEMUCaps *cachedcaps = NULL;
 
-        if (info->args.fakeCapsUsed) {
-            fprintf(stderr, "ARG_QEMU_CAPS can not be combined with ARG_CAPS_ARCH or ARG_CAPS_VER\n");
-            return -1;
-        }
-
         info->arch = virArchFromString(info->args.capsarch);
 
         if (STREQ(info->args.capsver, "latest")) {
@@ -805,6 +800,16 @@ testQemuInfoInitArgs(struct testQemuInfo *info)
         if (!(info->qemuCaps = virQEMUCapsNewCopy(cachedcaps)))
             return -1;
 
+        if (info->args.fakeCapsUsed) {
+            size_t i;
+            for (i = 0; i < QEMU_CAPS_LAST; i++) {
+                if (virQEMUCapsGet(info->args.fakeCaps, i)) {
+                    virQEMUCapsSet(info->qemuCaps, i);
+                }
+            }
+        }
+
+
         if (stripmachinealiases)
             virQEMUCapsStripMachineAliases(info->qemuCaps);