mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 01:45:17 +00:00
qemumonitorjsontest: mymain: Automatically free GHashTable
Use separate automatically cleared variables for the x86_64 and s390 versions of the QAPI schema. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
e28f5ddc56
commit
083ad77cd5
@ -2890,6 +2890,8 @@ mymain(void)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
virQEMUDriver driver;
|
virQEMUDriver driver;
|
||||||
testQemuMonitorJSONSimpleFuncData simpleFunc;
|
testQemuMonitorJSONSimpleFuncData simpleFunc;
|
||||||
|
g_autoptr(GHashTable) qapischema_x86_64 = NULL;
|
||||||
|
g_autoptr(GHashTable) qapischema_s390x = NULL;
|
||||||
struct testQAPISchemaData qapiData;
|
struct testQAPISchemaData qapiData;
|
||||||
g_autoptr(virJSONValue) metaschema = NULL;
|
g_autoptr(virJSONValue) metaschema = NULL;
|
||||||
g_autofree char *metaschemastr = NULL;
|
g_autofree char *metaschemastr = NULL;
|
||||||
@ -2899,12 +2901,14 @@ mymain(void)
|
|||||||
|
|
||||||
virEventRegisterDefaultImpl();
|
virEventRegisterDefaultImpl();
|
||||||
|
|
||||||
if (!(qapiData.schema = testQEMUSchemaLoadLatest("x86_64"))) {
|
if (!(qapischema_x86_64 = testQEMUSchemaLoadLatest("x86_64"))) {
|
||||||
VIR_TEST_VERBOSE("failed to load qapi schema");
|
VIR_TEST_VERBOSE("failed to load x86_64 qapi schema");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qapiData.schema = qapischema_x86_64;
|
||||||
|
|
||||||
#define DO_TEST(name) \
|
#define DO_TEST(name) \
|
||||||
do { \
|
do { \
|
||||||
testGenericData data = { driver.xmlopt, qapiData.schema }; \
|
testGenericData data = { driver.xmlopt, qapiData.schema }; \
|
||||||
@ -3171,18 +3175,18 @@ mymain(void)
|
|||||||
|
|
||||||
#undef DO_TEST_QUERY_JOBS
|
#undef DO_TEST_QUERY_JOBS
|
||||||
|
|
||||||
virHashFree(qapiData.schema);
|
if (!(qapischema_s390x = testQEMUSchemaLoadLatest("s390x"))) {
|
||||||
if (!(qapiData.schema = testQEMUSchemaLoadLatest("s390x"))) {
|
|
||||||
VIR_TEST_VERBOSE("failed to load qapi schema for s390x");
|
VIR_TEST_VERBOSE("failed to load qapi schema for s390x");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qapiData.schema = qapischema_s390x;
|
||||||
|
|
||||||
DO_TEST(qemuMonitorJSONGetCPUModelComparison);
|
DO_TEST(qemuMonitorJSONGetCPUModelComparison);
|
||||||
DO_TEST(qemuMonitorJSONGetCPUModelBaseline);
|
DO_TEST(qemuMonitorJSONGetCPUModelBaseline);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virHashFree(qapiData.schema);
|
|
||||||
qemuTestDriverFree(&driver);
|
qemuTestDriverFree(&driver);
|
||||||
return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user