virCaps was used only to propagate the host architecture, so the
function can be extracted in a way which does not require it.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
tests/testutilsqemu.c | 21 +++++++++++++++------
tests/testutilsqemu.h | 3 +++
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index f8182033fc..9671a46f12 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -486,16 +486,13 @@ qemuTestSetHostCPU(virCapsPtr caps,
virQEMUCapsPtr
-qemuTestParseCapabilities(virCapsPtr caps,
- const char *capsFile)
+qemuTestParseCapabilitiesArch(virArch arch,
+ const char *capsFile)
{
virQEMUCapsPtr qemuCaps = NULL;
- if (!caps)
- return NULL;
-
if (!(qemuCaps = virQEMUCapsNew()) ||
- virQEMUCapsLoadCache(caps->host.arch, qemuCaps, capsFile) < 0)
+ virQEMUCapsLoadCache(arch, qemuCaps, capsFile) < 0)
goto error;
return qemuCaps;
@@ -505,6 +502,18 @@ qemuTestParseCapabilities(virCapsPtr caps,
return NULL;
}
+
+virQEMUCapsPtr
+qemuTestParseCapabilities(virCapsPtr caps,
+ const char *capsFile)
+{
+ if (!caps)
+ return NULL;
+
+ return qemuTestParseCapabilitiesArch(caps->host.arch, capsFile);
+}
+
+
void qemuTestDriverFree(virQEMUDriver *driver)
{
virMutexDestroy(&driver->lock);
diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h
index f29c6e5d62..7ae8324933 100644
--- a/tests/testutilsqemu.h
+++ b/tests/testutilsqemu.h
@@ -16,6 +16,9 @@ enum {
virCapsPtr testQemuCapsInit(void);
virDomainXMLOptionPtr testQemuXMLConfInit(void);
+
+virQEMUCapsPtr qemuTestParseCapabilitiesArch(virArch arch,
+ const char *capsFile);
virQEMUCapsPtr qemuTestParseCapabilities(virCapsPtr caps,
const char *capsFile);
--
2.16.2