qemuxml2argvtest: Avoid conditions in test macro

Pass a pointer to the 'ret' variable to the test executor itself and
update it there to improve compile times of the test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-08-17 16:35:20 +02:00
parent 68bb5f9fa6
commit ca5c8e1dc7
4 changed files with 11 additions and 6 deletions

View File

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

View File

@ -826,6 +826,9 @@ testCompareXMLToArgv(const void *data)
if (info->arch != VIR_ARCH_NONE && info->arch != VIR_ARCH_X86_64)
qemuTestSetHostArch(&driver, VIR_ARCH_NONE);
if (ret < 0)
*info->conf->retptr = ret;
return ret;
}
@ -853,7 +856,8 @@ mymain(void)
g_autoptr(GHashTable) capscache = virHashNew(virObjectFreeHashData);
struct testQemuConf testConf = { .capslatest = capslatest,
.capscache = capscache,
.qapiSchemaCache = qapiSchemaCache };
.qapiSchemaCache = qapiSchemaCache,
.retptr = &ret };
if (!capslatest)
return EXIT_FAILURE;
@ -948,9 +952,7 @@ mymain(void)
}; \
testQemuInfoSetArgs(&info, &testConf, __VA_ARGS__); \
testInfoSetPaths(&info, _suffix); \
if (virTestRun("QEMU XML-2-ARGV " _name _suffix, \
testCompareXMLToArgv, &info) < 0) \
ret = -1; \
virTestRun("QEMU XML-2-ARGV " _name _suffix, testCompareXMLToArgv, &info); \
testQemuInfoClear(&info); \
} while (0)

View File

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

View File

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