提交 e231798b 编写于 作者: C Cole Robinson

tests: qemuxml2xml: Remove info->outActiveName

Reuse info->outfile for it. This requires us to set paths before
each virTestRun invocation
Reviewed-by: NAndrea Bolognani <abologna@redhat.com>
Signed-off-by: NCole Robinson <crobinso@redhat.com>
上级 ebf6df81
...@@ -28,7 +28,6 @@ enum { ...@@ -28,7 +28,6 @@ enum {
struct testInfo { struct testInfo {
char *infile; char *infile;
char *outfile; char *outfile;
char *outInactiveName;
virQEMUCapsPtr qemuCaps; virQEMUCapsPtr qemuCaps;
}; };
...@@ -50,9 +49,8 @@ testXML2XMLInactive(const void *opaque) ...@@ -50,9 +49,8 @@ testXML2XMLInactive(const void *opaque)
{ {
const struct testInfo *info = opaque; const struct testInfo *info = opaque;
return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, info->infile, return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,
info->outInactiveName, false, info->infile, info->outfile, false, 0,
0,
TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS); TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS);
} }
...@@ -102,7 +100,6 @@ testInfoClear(struct testInfo *info) ...@@ -102,7 +100,6 @@ testInfoClear(struct testInfo *info)
{ {
VIR_FREE(info->infile); VIR_FREE(info->infile);
VIR_FREE(info->outfile); VIR_FREE(info->outfile);
VIR_FREE(info->outInactiveName);
virObjectUnref(info->qemuCaps); virObjectUnref(info->qemuCaps);
} }
...@@ -133,30 +130,17 @@ testInfoSetPaths(struct testInfo *info, ...@@ -133,30 +130,17 @@ testInfoSetPaths(struct testInfo *info,
const char *name, const char *name,
int when) int when)
{ {
if (virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml", VIR_FREE(info->infile);
abs_srcdir, name) < 0) VIR_FREE(info->outfile);
goto error;
if (when & WHEN_INACTIVE) {
if (virAsprintf(&info->outInactiveName,
"%s/qemuxml2xmloutdata/%s-inactive.xml",
abs_srcdir, name) < 0)
goto error;
if (!virFileExists(info->outInactiveName)) {
VIR_FREE(info->outInactiveName);
if (virAsprintf(&info->outInactiveName, if (virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml",
"%s/qemuxml2xmloutdata/%s.xml",
abs_srcdir, name) < 0) abs_srcdir, name) < 0)
goto error; goto error;
}
}
if (when & WHEN_ACTIVE) {
if (virAsprintf(&info->outfile, if (virAsprintf(&info->outfile,
"%s/qemuxml2xmloutdata/%s-active.xml", "%s/qemuxml2xmloutdata/%s-%s.xml",
abs_srcdir, name) < 0) abs_srcdir, name,
when == WHEN_ACTIVE ? "active" : "inactive") < 0)
goto error; goto error;
if (!virFileExists(info->outfile)) { if (!virFileExists(info->outfile)) {
...@@ -167,7 +151,6 @@ testInfoSetPaths(struct testInfo *info, ...@@ -167,7 +151,6 @@ testInfoSetPaths(struct testInfo *info,
abs_srcdir, name) < 0) abs_srcdir, name) < 0)
goto error; goto error;
} }
}
return 0; return 0;
...@@ -226,20 +209,27 @@ mymain(void) ...@@ -226,20 +209,27 @@ mymain(void)
# define DO_TEST_FULL(name, when, gic, ...) \ # define DO_TEST_FULL(name, when, gic, ...) \
do { \ do { \
if (testInfoSetCommon(&info, gic) < 0 || \ if (testInfoSetCommon(&info, gic) < 0) { \
testInfoSetPaths(&info, name, when) < 0) { \
VIR_TEST_DEBUG("Failed to generate test data for '%s'", name); \ VIR_TEST_DEBUG("Failed to generate test data for '%s'", name); \
return -1; \ return -1; \
} \ } \
virQEMUCapsSetList(info.qemuCaps, __VA_ARGS__, QEMU_CAPS_LAST); \ virQEMUCapsSetList(info.qemuCaps, __VA_ARGS__, QEMU_CAPS_LAST); \
\ \
if (info.outInactiveName) { \ if (when & WHEN_INACTIVE) { \
if (testInfoSetPaths(&info, name, WHEN_INACTIVE) < 0) { \
VIR_TEST_DEBUG("Failed to generate inactive paths for '%s'", name); \
return -1; \
} \
if (virTestRun("QEMU XML-2-XML-inactive " name, \ if (virTestRun("QEMU XML-2-XML-inactive " name, \
testXML2XMLInactive, &info) < 0) \ testXML2XMLInactive, &info) < 0) \
ret = -1; \ ret = -1; \
} \ } \
\ \
if (info.outfile) { \ if (when & WHEN_ACTIVE) { \
if (testInfoSetPaths(&info, name, WHEN_ACTIVE) < 0) { \
VIR_TEST_DEBUG("Failed to generate active paths for '%s'", name); \
return -1; \
} \
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; \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册