mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-08 12:41:29 +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;
|
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;
|
||||||
|
@ -826,6 +826,9 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -853,7 +856,8 @@ 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;
|
||||||
@ -948,9 +952,7 @@ mymain(void)
|
|||||||
}; \
|
}; \
|
||||||
testQemuInfoSetArgs(&info, &testConf, __VA_ARGS__); \
|
testQemuInfoSetArgs(&info, &testConf, __VA_ARGS__); \
|
||||||
testInfoSetPaths(&info, _suffix); \
|
testInfoSetPaths(&info, _suffix); \
|
||||||
if (virTestRun("QEMU XML-2-ARGV " _name _suffix, \
|
virTestRun("QEMU XML-2-ARGV " _name _suffix, testCompareXMLToArgv, &info); \
|
||||||
testCompareXMLToArgv, &info) < 0) \
|
|
||||||
ret = -1; \
|
|
||||||
testQemuInfoClear(&info); \
|
testQemuInfoClear(&info); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
@ -112,7 +112,8 @@ 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;
|
||||||
|
@ -58,6 +58,7 @@ struct testQemuConf {
|
|||||||
GHashTable *capscache;
|
GHashTable *capscache;
|
||||||
GHashTable *capslatest;
|
GHashTable *capslatest;
|
||||||
GHashTable *qapiSchemaCache;
|
GHashTable *qapiSchemaCache;
|
||||||
|
int *retptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct testQemuArgs {
|
struct testQemuArgs {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user