提交 1bf1b387 编写于 作者: D Daniel P. Berrange

Don't print all test suite errors to stderr in vmx2xmltest

The vmx2xmltest test would print all errors to stderr, which
is not helpful when running OOM tests, and differs from the
behaviour of other tests.
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 a8412f86
......@@ -73,51 +73,38 @@ testCapsInit(void)
static int
testCompareFiles(const char *vmx, const char *xml)
{
int result = -1;
int ret = -1;
char *vmxData = NULL;
char *xmlData = NULL;
char *formatted = NULL;
virDomainDefPtr def = NULL;
virErrorPtr err = NULL;
if (virtTestLoadFile(vmx, &vmxData) < 0) {
goto failure;
}
if (virtTestLoadFile(xml, &xmlData) < 0) {
goto failure;
}
def = virVMXParseConfig(&ctx, xmlopt, vmxData);
if (virtTestLoadFile(vmx, &vmxData) < 0)
goto cleanup;
if (def == NULL) {
err = virGetLastError();
fprintf(stderr, "ERROR: %s\n", err != NULL ? err->message : "<unknown>");
goto failure;
}
if (virtTestLoadFile(xml, &xmlData) < 0)
goto cleanup;
formatted = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE);
if (!(def = virVMXParseConfig(&ctx, xmlopt, vmxData)))
goto cleanup;
if (formatted == NULL) {
err = virGetLastError();
fprintf(stderr, "ERROR: %s\n", err != NULL ? err->message : "<unknown>");
goto failure;
}
if (!(formatted = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE)))
goto cleanup;
if (STRNEQ(xmlData, formatted)) {
virtTestDifference(stderr, xmlData, formatted);
goto failure;
goto cleanup;
}
result = 0;
ret = 0;
failure:
cleanup:
VIR_FREE(vmxData);
VIR_FREE(xmlData);
VIR_FREE(formatted);
virDomainDefFree(def);
return result;
return ret;
}
struct testInfo {
......@@ -128,7 +115,7 @@ struct testInfo {
static int
testCompareHelper(const void *data)
{
int result = -1;
int ret = -1;
const struct testInfo *info = data;
char *vmx = NULL;
char *xml = NULL;
......@@ -140,13 +127,13 @@ testCompareHelper(const void *data)
goto cleanup;
}
result = testCompareFiles(vmx, xml);
ret = testCompareFiles(vmx, xml);
cleanup:
VIR_FREE(vmx);
VIR_FREE(xml);
return result;
return ret;
}
static char *
......@@ -195,7 +182,7 @@ testParseVMXFileName(const char *fileName, void *opaque ATTRIBUTE_UNUSED)
static int
mymain(void)
{
int result = 0;
int ret = 0;
# define DO_TEST(_in, _out) \
do { \
......@@ -203,7 +190,7 @@ mymain(void)
virResetLastError(); \
if (virtTestRun("VMware VMX-2-XML "_in" -> "_out, 1, \
testCompareHelper, &info) < 0) { \
result = -1; \
ret = -1; \
} \
} while (0)
......@@ -299,7 +286,7 @@ mymain(void)
virObjectUnref(caps);
virObjectUnref(xmlopt);
return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册