tests: qemuxml2*test: switch to virTestRunLog

This essentially reverts:
commit ca5c8e1dc7801854d856cfc62f2054ae753a40c3
    qemuxml2argvtest: Avoid conditions in test macro

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Ján Tomko 2021-08-20 16:34:26 +02:00
parent 8628cbe6ad
commit e431293d74
4 changed files with 6 additions and 17 deletions

View File

@ -83,8 +83,7 @@ mymain(void)
g_autoptr(virConnect) conn = NULL; g_autoptr(virConnect) conn = NULL;
struct testQemuConf testConf = { .capslatest = capslatest, struct testQemuConf testConf = { .capslatest = capslatest,
.capscache = capscache, .capscache = capscache,
.qapiSchemaCache = NULL, .qapiSchemaCache = NULL };
.retptr = NULL };
if (!capslatest) if (!capslatest)
return EXIT_FAILURE; return EXIT_FAILURE;

View File

@ -766,8 +766,6 @@ testCompareXMLToArgv(const void *data)
goto cleanup; goto cleanup;
} }
log = virTestLogContentAndReset();
VIR_FREE(log);
virResetLastError(); virResetLastError();
if (!(cmd = testCompareXMLToArgvCreateArgs(&driver, vm, migrateURI, info, if (!(cmd = testCompareXMLToArgvCreateArgs(&driver, vm, migrateURI, info,
@ -826,9 +824,6 @@ testCompareXMLToArgv(const void *data)
if (info->arch != VIR_ARCH_NONE && info->arch != VIR_ARCH_X86_64) if (info->arch != VIR_ARCH_NONE && info->arch != VIR_ARCH_X86_64)
qemuTestSetHostArch(&driver, VIR_ARCH_NONE); qemuTestSetHostArch(&driver, VIR_ARCH_NONE);
if (ret < 0)
*info->conf->retptr = ret;
return ret; return ret;
} }
@ -856,8 +851,7 @@ mymain(void)
g_autoptr(GHashTable) capscache = virHashNew(virObjectFreeHashData); g_autoptr(GHashTable) capscache = virHashNew(virObjectFreeHashData);
struct testQemuConf testConf = { .capslatest = capslatest, struct testQemuConf testConf = { .capslatest = capslatest,
.capscache = capscache, .capscache = capscache,
.qapiSchemaCache = qapiSchemaCache, .qapiSchemaCache = qapiSchemaCache };
.retptr = &ret };
if (!capslatest) if (!capslatest)
return EXIT_FAILURE; return EXIT_FAILURE;
@ -952,7 +946,7 @@ mymain(void)
}; \ }; \
testQemuInfoSetArgs(&info, &testConf, __VA_ARGS__); \ testQemuInfoSetArgs(&info, &testConf, __VA_ARGS__); \
testInfoSetPaths(&info, _suffix); \ testInfoSetPaths(&info, _suffix); \
virTestRun("QEMU XML-2-ARGV " _name _suffix, testCompareXMLToArgv, &info); \ virTestRunLog(&ret, "QEMU XML-2-ARGV " _name _suffix, testCompareXMLToArgv, &info); \
testQemuInfoClear(&info); \ testQemuInfoClear(&info); \
} while (0) } while (0)

View File

@ -55,7 +55,6 @@ testXML2XMLActive(const void *opaque)
info->infile, info->outfile, true, info->infile, info->outfile, true,
info->parseFlags, info->parseFlags,
TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS) < 0) { TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS) < 0) {
*info->conf->retptr = -1;
return -1; return -1;
} }
@ -73,7 +72,6 @@ testXML2XMLInactive(const void *opaque)
info->infile, info->outfile, false, info->infile, info->outfile, false,
info->parseFlags, info->parseFlags,
TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS) < 0) { TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS) < 0) {
*info->conf->retptr = -1;
return -1; return -1;
} }
@ -118,8 +116,7 @@ mymain(void)
g_autoptr(virConnect) conn = NULL; g_autoptr(virConnect) conn = NULL;
struct testQemuConf testConf = { .capslatest = capslatest, struct testQemuConf testConf = { .capslatest = capslatest,
.capscache = capscache, .capscache = capscache,
.qapiSchemaCache = NULL, .qapiSchemaCache = NULL };
.retptr = &ret };
if (!capslatest) if (!capslatest)
return EXIT_FAILURE; return EXIT_FAILURE;
@ -168,12 +165,12 @@ mymain(void)
\ \
if (when & WHEN_INACTIVE) { \ if (when & WHEN_INACTIVE) { \
testInfoSetPaths(&info, suffix, WHEN_INACTIVE); \ testInfoSetPaths(&info, suffix, WHEN_INACTIVE); \
virTestRun("QEMU XML-2-XML-inactive " _name, testXML2XMLInactive, &info); \ virTestRunLog(&ret, "QEMU XML-2-XML-inactive " _name, testXML2XMLInactive, &info); \
} \ } \
\ \
if (when & WHEN_ACTIVE) { \ if (when & WHEN_ACTIVE) { \
testInfoSetPaths(&info, suffix, WHEN_ACTIVE); \ testInfoSetPaths(&info, suffix, WHEN_ACTIVE); \
virTestRun("QEMU XML-2-XML-active " _name, testXML2XMLActive, &info); \ virTestRunLog(&ret, "QEMU XML-2-XML-active " _name, testXML2XMLActive, &info); \
} \ } \
testQemuInfoClear(&info); \ testQemuInfoClear(&info); \
} while (0) } while (0)

View File

@ -58,7 +58,6 @@ struct testQemuConf {
GHashTable *capscache; GHashTable *capscache;
GHashTable *capslatest; GHashTable *capslatest;
GHashTable *qapiSchemaCache; GHashTable *qapiSchemaCache;
int *retptr;
}; };
struct testQemuArgs { struct testQemuArgs {