mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
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:
parent
68bb5f9fa6
commit
ca5c8e1dc7
@ -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;
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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;
|
||||
|
@ -58,6 +58,7 @@ struct testQemuConf {
|
||||
GHashTable *capscache;
|
||||
GHashTable *capslatest;
|
||||
GHashTable *qapiSchemaCache;
|
||||
int *retptr;
|
||||
};
|
||||
|
||||
struct testQemuArgs {
|
||||
|
Loading…
x
Reference in New Issue
Block a user