提交 022ccd3d 编写于 作者: J Jiri Denemark

tests: More output options for xml2xml tests

So far, qemuxml2xml test was only able to check if the result matches
the original or the appropriate XML in qemuxml2xmloutdata regardless on
flags used to format the XML. Since the result can be different
depending on VIR_DOMAIN_XML_INACTIVE flag being used or not, this patch
adds support for qemuxml2xmlout-%s-active.xml and
qemuxml2xmlout-%s-inactive.xml output files. If the file specific to the
flag used exists, it is used in preference to the generic
qemuxml2xmlout-%s.xml file when reading the expected output.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 546154e3
......@@ -81,31 +81,55 @@ testCompareXMLToXMLHelper(const void *data)
const struct testInfo *info = data;
char *xml_in = NULL;
char *xml_out = NULL;
char *xml_out_active = NULL;
char *xml_out_inactive = NULL;
int ret = -1;
if (virAsprintf(&xml_in, "%s/qemuxml2argvdata/qemuxml2argv-%s.xml",
abs_srcdir, info->name) < 0 ||
virAsprintf(&xml_out, "%s/qemuxml2xmloutdata/qemuxml2xmlout-%s.xml",
abs_srcdir, info->name) < 0 ||
virAsprintf(&xml_out_active,
"%s/qemuxml2xmloutdata/qemuxml2xmlout-%s-active.xml",
abs_srcdir, info->name) < 0 ||
virAsprintf(&xml_out_inactive,
"%s/qemuxml2xmloutdata/qemuxml2xmlout-%s-inactive.xml",
abs_srcdir, info->name) < 0)
goto cleanup;
if ((info->when & WHEN_INACTIVE) &&
testCompareXMLToXMLFiles(xml_in,
info->different ? xml_out : xml_in,
false) < 0)
goto cleanup;
if ((info->when & WHEN_INACTIVE)) {
char *out;
if (!info->different)
out = xml_in;
else if (virFileExists(xml_out_inactive))
out = xml_out_inactive;
else
out = xml_out;
if (testCompareXMLToXMLFiles(xml_in, out, false) < 0)
goto cleanup;
}
if ((info->when & WHEN_ACTIVE) &&
testCompareXMLToXMLFiles(xml_in,
info->different ? xml_out : xml_in,
true) < 0)
goto cleanup;
if ((info->when & WHEN_ACTIVE)) {
char *out;
if (!info->different)
out = xml_in;
else if (virFileExists(xml_out_active))
out = xml_out_active;
else
out = xml_out;
if (testCompareXMLToXMLFiles(xml_in, out, true) < 0)
goto cleanup;
}
ret = 0;
cleanup:
VIR_FREE(xml_in);
VIR_FREE(xml_out);
VIR_FREE(xml_out_active);
VIR_FREE(xml_out_inactive);
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册