On Tue, Apr 11, 2017 at 01:39:08PM +0200, Ján Tomko wrote:
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(a)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?
No, this is a leftover from early version where I was parsing the binary
from the *xml*. I'll drop the movement.
> 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.
This one is also a leftover, but it makes sense so I'll move it to
separate patch.
Pavel