]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: qemu: Don't add fake machine types when testing with real data
authorPeter Krempa <pkrempa@redhat.com>
Thu, 23 Jan 2020 12:23:35 +0000 (13:23 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 27 Jan 2020 13:55:03 +0000 (14:55 +0100)
Skip the step of adding all of the fake machine types which are required
for the legacy tests in case when we are testing with real capabilities.

Faking any data in the real capabilities undermines the point of testing
with real capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tests/testutilsqemu.c

index 10f1138bca25e4f353b7c4b7ce324186c13b3da3..d44548f7952388285d990f234ed4e0260d76f40d 100644 (file)
@@ -332,28 +332,32 @@ int qemuTestCapsCacheInsert(virFileCachePtr cache,
         } else {
             tmpCaps = virQEMUCapsNew();
         }
-        virQEMUCapsSetArch(tmpCaps, i);
-        for (j = 0; qemu_machines[i][j] != NULL; j++) {
-            virQEMUCapsAddMachine(tmpCaps,
-                                  VIR_DOMAIN_VIRT_QEMU,
-                                  qemu_machines[i][j],
-                                  NULL,
-                                  NULL,
-                                  0,
-                                  false,
-                                  false);
-        }
-        for (j = 0; kvm_machines[i][j] != NULL; j++) {
-            virQEMUCapsAddMachine(tmpCaps,
-                                  VIR_DOMAIN_VIRT_KVM,
-                                  kvm_machines[i][j],
-                                  NULL,
-                                  NULL,
-                                  0,
-                                  false,
-                                  false);
-            virQEMUCapsSet(tmpCaps, QEMU_CAPS_KVM);
+
+        if (!virQEMUCapsHasMachines(tmpCaps)) {
+            virQEMUCapsSetArch(tmpCaps, i);
+            for (j = 0; qemu_machines[i][j] != NULL; j++) {
+                virQEMUCapsAddMachine(tmpCaps,
+                                      VIR_DOMAIN_VIRT_QEMU,
+                                      qemu_machines[i][j],
+                                      NULL,
+                                      NULL,
+                                      0,
+                                      false,
+                                      false);
+            }
+            for (j = 0; kvm_machines[i][j] != NULL; j++) {
+                virQEMUCapsAddMachine(tmpCaps,
+                                      VIR_DOMAIN_VIRT_KVM,
+                                      kvm_machines[i][j],
+                                      NULL,
+                                      NULL,
+                                      0,
+                                      false,
+                                      false);
+                virQEMUCapsSet(tmpCaps, QEMU_CAPS_KVM);
+            }
         }
+
         if (virFileCacheInsertData(cache, qemu_emulators[i], tmpCaps) < 0) {
             virObjectUnref(tmpCaps);
             return -1;