Re: [PATCH 8/8] tests/testutilsqemu: properly initialize qemu caps for tests

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

 



On Fri, Apr 07, 2017 at 03:44:23PM +0200, Pavel Hrdina wrote:
This removes the hacky extern global variable and modifies the
test code to properly create QEMU capabilities cache for QEMU
binaries used in our tests.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
src/qemu/qemu_capabilities.c |  6 ------
tests/qemuhotplugtest.c      | 11 ++++-------
tests/qemuxml2argvtest.c     |  7 +++----
tests/qemuxml2xmltest.c      | 30 ++++++++++++++++--------------
tests/testutilsqemu.c        | 36 +++++++++++++++++++-----------------
tests/testutilsqemu.h        |  5 +----
6 files changed, 43 insertions(+), 52 deletions(-)


diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 18ff5ad147..525aa67e02 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -434,16 +434,15 @@ testCompareXMLToArgv(const void *data)
    if (virQEMUCapsGet(info->qemuCaps, QEMU_CAPS_ENABLE_FIPS))
        flags |= FLAG_FIPS;

-    if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->name,
-                                info->qemuCaps) < 0)
-        goto cleanup;
-
    if (virAsprintf(&xml, "%s/qemuxml2argvdata/qemuxml2argv-%s.xml",
                    abs_srcdir, info->name) < 0 ||
        virAsprintf(&args, "%s/qemuxml2argvdata/qemuxml2argv-%s.args",
                    abs_srcdir, info->name) < 0)
        goto cleanup;

+    if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0)
+        goto cleanup;
+

Is there a reason for exchaging these two conditions?

    if (info->migrateFrom &&
        !(migrateURI = qemuMigrationIncomingURI(info->migrateFrom,
                                                info->migrateFd)))

diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 579328912a..e1ef9e5b86 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -293,15 +294,16 @@ testInfoSet(struct testInfo *info,
            if (virAsprintf(&info->outActiveName,
                            "%s/qemuxml2xmloutdata/qemuxml2xmlout-%s.xml",
                            abs_srcdir, name) < 0)
-                goto error;
+                goto cleanup;
        }
    }

-    return 0;
+    ret = 0;

- error:
-    testInfoFree(info);
-    return -1;
+ cleanup:
+    if (ret < 0)
+        testInfoFree(info);
+    return ret;
}

The error -> cleanup change also does not belong in this patch.

Jan

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[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