[libvirt] [PATCH 7/9] tests: do not mangle real qemu caps in xml2argvtest

Ján Tomko jtomko at redhat.com
Sun Sep 9 02:10:34 UTC 2018


None of the things testUpdateQEMUCaps adjusts are applicable
for tests that use the DO_TEST_CAPS macros, i.e.
real QEMU capabilities parsed from the XML files:

The architecture must be chosen before we even open the caps
file, CPU models are already present and the expensive HostModel
computation was already done in virQEMUCapsLoadCache.

Introduce FLAG_REAL_CAPS and skip the whole testUpdateQEMUCaps
function for DO_TEST_CAPS.

This speeds up the test by 25 %

Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 tests/qemuxml2argvtest.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 16427b3c85..36fa99392a 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -294,6 +294,7 @@ typedef enum {
     FLAG_EXPECT_PARSE_ERROR = 1 << 1,
     FLAG_FIPS               = 1 << 2,
     FLAG_STEAL_VM           = 1 << 3,
+    FLAG_REAL_CAPS          = 1 << 4,
 } virQemuXML2ArgvTestFlags;
 
 struct testInfo {
@@ -568,7 +569,8 @@ testCompareXMLToArgv(const void *data)
     if (qemuProcessPrepareMonitorChr(&monitor_chr, priv->libDir) < 0)
         goto cleanup;
 
-    if (testUpdateQEMUCaps(info, vm, driver.caps) < 0)
+    if (!(info->flags & FLAG_REAL_CAPS) &&
+        testUpdateQEMUCaps(info, vm, driver.caps) < 0)
         goto cleanup;
 
     log = virTestLogContentAndReset();
@@ -785,7 +787,7 @@ mymain(void)
     do { \
         static struct testInfo info = { \
             name, "." suffix, NULL, migrateFrom, migrateFrom ? 7 : -1,\
-            (flags), parseFlags, false, NULL \
+            (flags | FLAG_REAL_CAPS), parseFlags, false, NULL \
         }; \
         info.skipLegacyCPUs = skipLegacyCPUs; \
         if (!(info.qemuCaps = qemuTestParseCapabilitiesArch(virArchFromString(arch), \
-- 
2.16.4




More information about the libvir-list mailing list