[PATCH 16/21] tests: qemu: Don't add fake machine types when testing with real data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 tests/testutilsqemu.c | 46 +++++++++++++++++++++++--------------------
 1 file changed, 25 insertions(+), 21 deletions(-)

diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 69a3e88275..96e5f92a58 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -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;
-- 
2.24.1





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux