[libvirt] [PATCH v3 47/52] qemuxml2argvtest: Update host arch for DO_TEST*ARCH* tests

Jiri Denemark jdenemar at redhat.com
Tue Nov 5 13:27:45 UTC 2019


To avoid mismatch between host and QEMU capabilities.

Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---

Notes:
    Version 3:
    - new patch

 tests/qemuxml2argvtest.c | 4 ++++
 tests/testutilsqemu.c    | 6 +++---
 tests/testutilsqemu.h    | 1 +
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index fd330df3e0..7c00c72aff 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -717,9 +717,13 @@ mymain(void)
             VIR_TEST_DEBUG("Failed to generate paths for '%s'", _name); \
             return EXIT_FAILURE; \
         } \
+        if (info.arch != VIR_ARCH_NONE && info.arch != VIR_ARCH_X86_64) \
+            qemuTestSetHostArch(driver.caps, info.arch); \
         if (virTestRun("QEMU XML-2-ARGV " _name _suffix, \
                        testCompareXMLToArgv, &info) < 0) \
             ret = -1; \
+        if (info.arch != VIR_ARCH_NONE && info.arch != VIR_ARCH_X86_64) \
+            qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE); \
         testQemuInfoClear(&info); \
     } while (0)
 
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 54d6b1a0ac..ba9b56003a 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -1061,6 +1061,8 @@ testQemuInfoSetArgs(struct testQemuInfo *info,
     if (!qemuCaps && capsarch && capsver) {
         bool stripmachinealiases = false;
 
+        info->arch = virArchFromString(capsarch);
+
         if (STREQ(capsver, "latest")) {
             capsfile = g_strdup(virHashLookup(capslatest, capsarch));
             stripmachinealiases = true;
@@ -1069,10 +1071,8 @@ testQemuInfoSetArgs(struct testQemuInfo *info,
             goto cleanup;
         }
 
-        if (!(qemuCaps = qemuTestParseCapabilitiesArch(virArchFromString(capsarch),
-                                                       capsfile))) {
+        if (!(qemuCaps = qemuTestParseCapabilitiesArch(info->arch, capsfile)))
             goto cleanup;
-        }
 
         if (stripmachinealiases)
             virQEMUCapsStripMachineAliases(qemuCaps);
diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h
index 714a95bb7a..da3bf3ab7a 100644
--- a/tests/testutilsqemu.h
+++ b/tests/testutilsqemu.h
@@ -63,6 +63,7 @@ struct testQemuInfo {
     int migrateFd;
     unsigned int flags;
     unsigned int parseFlags;
+    virArch arch;
 };
 
 virCapsPtr testQemuCapsInit(void);
-- 
2.23.0




More information about the libvir-list mailing list