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

tests: qemuxml2xml: drop early file loading

For the standard active/inactive XML testing, if we leave the file loading
up to the generic XML2XML infrastructure, we get the benefit of
VIR_TEST_REGENERATE_OUTPUT, at the price of a few more disk reads. Seems
worth it.
上级 5770c170
......@@ -30,13 +30,8 @@ enum {
struct testInfo {
char *inName;
char *inFile;
char *outActiveName;
char *outActiveFile;
char *outInactiveName;
char *outInactiveFile;
};
static int
......@@ -95,13 +90,19 @@ testCompareStatusXMLToXMLFiles(const void *opaque)
char *expect = NULL;
char *actual = NULL;
char *source = NULL;
char *inFile = NULL, *outActiveFile = NULL;
int ret = -1;
int keepBlanksDefault = xmlKeepBlanksDefault(0);
if (virtTestLoadFile(data->inName, &inFile) < 0)
goto cleanup;
if (virtTestLoadFile(data->outActiveName, &outActiveFile) < 0)
goto cleanup;
/* construct faked source status XML */
virBufferAdd(&buf, testStatusXMLPrefix, -1);
virBufferAdjustIndent(&buf, 2);
virBufferAddStr(&buf, data->inFile);
virBufferAddStr(&buf, inFile);
virBufferAdjustIndent(&buf, -2);
virBufferAdd(&buf, testStatusXMLSuffix, -1);
......@@ -113,7 +114,7 @@ testCompareStatusXMLToXMLFiles(const void *opaque)
/* construct the expect string */
virBufferAdd(&buf, testStatusXMLPrefix, -1);
virBufferAdjustIndent(&buf, 2);
virBufferAddStr(&buf, data->outActiveFile);
virBufferAddStr(&buf, outActiveFile);
virBufferAdjustIndent(&buf, -2);
virBufferAdd(&buf, testStatusXMLSuffix, -1);
......@@ -158,6 +159,8 @@ testCompareStatusXMLToXMLFiles(const void *opaque)
VIR_FREE(expect);
VIR_FREE(actual);
VIR_FREE(source);
VIR_FREE(inFile);
VIR_FREE(outActiveFile);
return ret;
}
......@@ -166,13 +169,8 @@ static void
testInfoFree(struct testInfo *info)
{
VIR_FREE(info->inName);
VIR_FREE(info->inFile);
VIR_FREE(info->outActiveName);
VIR_FREE(info->outActiveFile);
VIR_FREE(info->outInactiveName);
VIR_FREE(info->outInactiveFile);
}
......@@ -186,9 +184,6 @@ testInfoSet(struct testInfo *info,
abs_srcdir, name) < 0)
goto error;
if (virtTestLoadFile(info->inName, &info->inFile) < 0)
goto error;
if (when & WHEN_INACTIVE) {
if (different) {
if (virAsprintf(&info->outInactiveName,
......@@ -208,9 +203,6 @@ testInfoSet(struct testInfo *info,
if (VIR_STRDUP(info->outInactiveName, info->inName) < 0)
goto error;
}
if (virtTestLoadFile(info->outInactiveName, &info->outInactiveFile) < 0)
goto error;
}
if (when & WHEN_ACTIVE) {
......@@ -233,8 +225,6 @@ testInfoSet(struct testInfo *info,
goto error;
}
if (virtTestLoadFile(info->outActiveName, &info->outActiveFile) < 0)
goto error;
}
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册