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

Ján Tomko jtomko at redhat.com
Tue Apr 11 11:39:08 UTC 2017


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 at redhat.com>
>---
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170411/8a193dca/attachment-0001.sig>


More information about the libvir-list mailing list