mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +00:00
tests: qemuxml2xml: Use struct testQemuInfo
The qemuxml2xml testInfo is now just a subset of testQemuInfo, so it's a drop in replacement Reviewed-by: Andrea Bolognani <abologna@redhat.com> Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
89effa6159
commit
0bae87d674
@ -25,18 +25,11 @@ enum {
|
|||||||
WHEN_BOTH = 3,
|
WHEN_BOTH = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct testInfo {
|
|
||||||
char *infile;
|
|
||||||
char *outfile;
|
|
||||||
|
|
||||||
virQEMUCapsPtr qemuCaps;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
testXML2XMLActive(const void *opaque)
|
testXML2XMLActive(const void *opaque)
|
||||||
{
|
{
|
||||||
const struct testInfo *info = opaque;
|
const struct testQemuInfo *info = opaque;
|
||||||
|
|
||||||
return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,
|
return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,
|
||||||
info->infile, info->outfile, true, 0,
|
info->infile, info->outfile, true, 0,
|
||||||
@ -47,7 +40,7 @@ testXML2XMLActive(const void *opaque)
|
|||||||
static int
|
static int
|
||||||
testXML2XMLInactive(const void *opaque)
|
testXML2XMLInactive(const void *opaque)
|
||||||
{
|
{
|
||||||
const struct testInfo *info = opaque;
|
const struct testQemuInfo *info = opaque;
|
||||||
|
|
||||||
return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,
|
return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,
|
||||||
info->infile, info->outfile, false, 0,
|
info->infile, info->outfile, false, 0,
|
||||||
@ -58,7 +51,7 @@ testXML2XMLInactive(const void *opaque)
|
|||||||
static int
|
static int
|
||||||
testCompareStatusXMLToXMLFiles(const void *opaque)
|
testCompareStatusXMLToXMLFiles(const void *opaque)
|
||||||
{
|
{
|
||||||
const struct testInfo *data = opaque;
|
const struct testQemuInfo *data = opaque;
|
||||||
virDomainObjPtr obj = NULL;
|
virDomainObjPtr obj = NULL;
|
||||||
char *actual = NULL;
|
char *actual = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -95,18 +88,8 @@ testCompareStatusXMLToXMLFiles(const void *opaque)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
testInfoClear(struct testInfo *info)
|
|
||||||
{
|
|
||||||
VIR_FREE(info->infile);
|
|
||||||
VIR_FREE(info->outfile);
|
|
||||||
|
|
||||||
virObjectUnref(info->qemuCaps);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
testInfoSetCommon(struct testInfo *info,
|
testInfoSetCommon(struct testQemuInfo *info,
|
||||||
int gic)
|
int gic)
|
||||||
{
|
{
|
||||||
if (!(info->qemuCaps = virQEMUCapsNew()))
|
if (!(info->qemuCaps = virQEMUCapsNew()))
|
||||||
@ -121,12 +104,12 @@ testInfoSetCommon(struct testInfo *info,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
testInfoClear(info);
|
testQemuInfoClear(info);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
testInfoSetPaths(struct testInfo *info,
|
testInfoSetPaths(struct testQemuInfo *info,
|
||||||
const char *name,
|
const char *name,
|
||||||
int when)
|
int when)
|
||||||
{
|
{
|
||||||
@ -155,7 +138,7 @@ testInfoSetPaths(struct testInfo *info,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
testInfoClear(info);
|
testQemuInfoClear(info);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +146,7 @@ testInfoSetPaths(struct testInfo *info,
|
|||||||
static const char *statusPath = abs_srcdir "/qemustatusxml2xmldata/";
|
static const char *statusPath = abs_srcdir "/qemustatusxml2xmldata/";
|
||||||
|
|
||||||
static int
|
static int
|
||||||
testInfoSetStatusPaths(struct testInfo *info,
|
testInfoSetStatusPaths(struct testQemuInfo *info,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
if (virAsprintf(&info->infile, "%s%s-in.xml", statusPath, name) < 0 ||
|
if (virAsprintf(&info->infile, "%s%s-in.xml", statusPath, name) < 0 ||
|
||||||
@ -173,7 +156,7 @@ testInfoSetStatusPaths(struct testInfo *info,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
testInfoClear(info);
|
testQemuInfoClear(info);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +168,7 @@ mymain(void)
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char *fakerootdir;
|
char *fakerootdir;
|
||||||
struct testInfo info;
|
struct testQemuInfo info;
|
||||||
virQEMUDriverConfigPtr cfg = NULL;
|
virQEMUDriverConfigPtr cfg = NULL;
|
||||||
|
|
||||||
if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) {
|
if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) {
|
||||||
@ -234,7 +217,7 @@ mymain(void)
|
|||||||
testXML2XMLActive, &info) < 0) \
|
testXML2XMLActive, &info) < 0) \
|
||||||
ret = -1; \
|
ret = -1; \
|
||||||
} \
|
} \
|
||||||
testInfoClear(&info); \
|
testQemuInfoClear(&info); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
# define NONE QEMU_CAPS_LAST
|
# define NONE QEMU_CAPS_LAST
|
||||||
@ -1247,7 +1230,7 @@ mymain(void)
|
|||||||
testCompareStatusXMLToXMLFiles, &info) < 0) \
|
testCompareStatusXMLToXMLFiles, &info) < 0) \
|
||||||
ret = -1; \
|
ret = -1; \
|
||||||
\
|
\
|
||||||
testInfoClear(&info); \
|
testQemuInfoClear(&info); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user