mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
tests: qemuxml2xml: Add info->{in,out}file
Just renamed from existing inName and outActiveName Reviewed-by: Andrea Bolognani <abologna@redhat.com> Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
05388311b6
commit
ebf6df814e
@ -26,8 +26,8 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct testInfo {
|
struct testInfo {
|
||||||
char *inName;
|
char *infile;
|
||||||
char *outActiveName;
|
char *outfile;
|
||||||
char *outInactiveName;
|
char *outInactiveName;
|
||||||
|
|
||||||
virQEMUCapsPtr qemuCaps;
|
virQEMUCapsPtr qemuCaps;
|
||||||
@ -40,8 +40,7 @@ testXML2XMLActive(const void *opaque)
|
|||||||
const struct testInfo *info = opaque;
|
const struct testInfo *info = opaque;
|
||||||
|
|
||||||
return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,
|
return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,
|
||||||
info->inName, info->outActiveName, true,
|
info->infile, info->outfile, true, 0,
|
||||||
0,
|
|
||||||
TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS);
|
TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +50,7 @@ testXML2XMLInactive(const void *opaque)
|
|||||||
{
|
{
|
||||||
const struct testInfo *info = opaque;
|
const struct testInfo *info = opaque;
|
||||||
|
|
||||||
return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, info->inName,
|
return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, info->infile,
|
||||||
info->outInactiveName, false,
|
info->outInactiveName, false,
|
||||||
0,
|
0,
|
||||||
TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS);
|
TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS);
|
||||||
@ -66,13 +65,13 @@ testCompareStatusXMLToXMLFiles(const void *opaque)
|
|||||||
char *actual = NULL;
|
char *actual = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if (!(obj = virDomainObjParseFile(data->inName, driver.caps, driver.xmlopt,
|
if (!(obj = virDomainObjParseFile(data->infile, driver.caps, driver.xmlopt,
|
||||||
VIR_DOMAIN_DEF_PARSE_STATUS |
|
VIR_DOMAIN_DEF_PARSE_STATUS |
|
||||||
VIR_DOMAIN_DEF_PARSE_ACTUAL_NET |
|
VIR_DOMAIN_DEF_PARSE_ACTUAL_NET |
|
||||||
VIR_DOMAIN_DEF_PARSE_PCI_ORIG_STATES |
|
VIR_DOMAIN_DEF_PARSE_PCI_ORIG_STATES |
|
||||||
VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE |
|
VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE |
|
||||||
VIR_DOMAIN_DEF_PARSE_ALLOW_POST_PARSE_FAIL))) {
|
VIR_DOMAIN_DEF_PARSE_ALLOW_POST_PARSE_FAIL))) {
|
||||||
VIR_TEST_DEBUG("\nfailed to parse '%s'\n", data->inName);
|
VIR_TEST_DEBUG("\nfailed to parse '%s'\n", data->infile);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,11 +81,11 @@ testCompareStatusXMLToXMLFiles(const void *opaque)
|
|||||||
VIR_DOMAIN_DEF_FORMAT_ACTUAL_NET |
|
VIR_DOMAIN_DEF_FORMAT_ACTUAL_NET |
|
||||||
VIR_DOMAIN_DEF_FORMAT_PCI_ORIG_STATES |
|
VIR_DOMAIN_DEF_FORMAT_PCI_ORIG_STATES |
|
||||||
VIR_DOMAIN_DEF_FORMAT_CLOCK_ADJUST))) {
|
VIR_DOMAIN_DEF_FORMAT_CLOCK_ADJUST))) {
|
||||||
VIR_TEST_DEBUG("\nfailed to format back '%s'\n", data->inName);
|
VIR_TEST_DEBUG("\nfailed to format back '%s'\n", data->infile);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virTestCompareToFile(actual, data->outActiveName) < 0)
|
if (virTestCompareToFile(actual, data->outfile) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -101,8 +100,8 @@ testCompareStatusXMLToXMLFiles(const void *opaque)
|
|||||||
static void
|
static void
|
||||||
testInfoClear(struct testInfo *info)
|
testInfoClear(struct testInfo *info)
|
||||||
{
|
{
|
||||||
VIR_FREE(info->inName);
|
VIR_FREE(info->infile);
|
||||||
VIR_FREE(info->outActiveName);
|
VIR_FREE(info->outfile);
|
||||||
VIR_FREE(info->outInactiveName);
|
VIR_FREE(info->outInactiveName);
|
||||||
|
|
||||||
virObjectUnref(info->qemuCaps);
|
virObjectUnref(info->qemuCaps);
|
||||||
@ -134,7 +133,7 @@ testInfoSetPaths(struct testInfo *info,
|
|||||||
const char *name,
|
const char *name,
|
||||||
int when)
|
int when)
|
||||||
{
|
{
|
||||||
if (virAsprintf(&info->inName, "%s/qemuxml2argvdata/%s.xml",
|
if (virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml",
|
||||||
abs_srcdir, name) < 0)
|
abs_srcdir, name) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@ -155,15 +154,15 @@ testInfoSetPaths(struct testInfo *info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (when & WHEN_ACTIVE) {
|
if (when & WHEN_ACTIVE) {
|
||||||
if (virAsprintf(&info->outActiveName,
|
if (virAsprintf(&info->outfile,
|
||||||
"%s/qemuxml2xmloutdata/%s-active.xml",
|
"%s/qemuxml2xmloutdata/%s-active.xml",
|
||||||
abs_srcdir, name) < 0)
|
abs_srcdir, name) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (!virFileExists(info->outActiveName)) {
|
if (!virFileExists(info->outfile)) {
|
||||||
VIR_FREE(info->outActiveName);
|
VIR_FREE(info->outfile);
|
||||||
|
|
||||||
if (virAsprintf(&info->outActiveName,
|
if (virAsprintf(&info->outfile,
|
||||||
"%s/qemuxml2xmloutdata/%s.xml",
|
"%s/qemuxml2xmloutdata/%s.xml",
|
||||||
abs_srcdir, name) < 0)
|
abs_srcdir, name) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@ -184,8 +183,8 @@ static int
|
|||||||
testInfoSetStatusPaths(struct testInfo *info,
|
testInfoSetStatusPaths(struct testInfo *info,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
if (virAsprintf(&info->inName, "%s%s-in.xml", statusPath, name) < 0 ||
|
if (virAsprintf(&info->infile, "%s%s-in.xml", statusPath, name) < 0 ||
|
||||||
virAsprintf(&info->outActiveName, "%s%s-out.xml", statusPath, name) < 0)
|
virAsprintf(&info->outfile, "%s%s-out.xml", statusPath, name) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -240,7 +239,7 @@ mymain(void)
|
|||||||
ret = -1; \
|
ret = -1; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
if (info.outActiveName) { \
|
if (info.outfile) { \
|
||||||
if (virTestRun("QEMU XML-2-XML-active " name, \
|
if (virTestRun("QEMU XML-2-XML-active " name, \
|
||||||
testXML2XMLActive, &info) < 0) \
|
testXML2XMLActive, &info) < 0) \
|
||||||
ret = -1; \
|
ret = -1; \
|
||||||
|
Loading…
Reference in New Issue
Block a user