From e0454c4801452c031856681c68bf5d154440bbb0 Mon Sep 17 00:00:00 2001 Message-Id: From: Peter Krempa Date: Mon, 16 Mar 2020 22:12:09 +0100 Subject: [PATCH] qemublocktest: Load QMP schema earlier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Multiple tests require the schema. Extract the loading into a separate variable to avoid issues with ownership of the pointer. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko (cherry picked from commit 1262cdede447a2566b6e8cb99434b767a4ef67da) Conflicts: tests/qemublocktest.c QMP schema loading for non-x86_64 qemus was not backported. https://bugzilla.redhat.com/show_bug.cgi?id=1804750 Message-Id: Reviewed-by: Ján Tomko --- tests/qemublocktest.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 3057db6930..f805265c93 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -863,6 +863,7 @@ mymain(void) struct testQemuBlockBitmapBlockcopyData blockbitmapblockcopydata; char *capslatest_x86_64 = NULL; virQEMUCapsPtr caps_x86_64 = NULL; + g_autoptr(virHashTable) qmp_schema_x86_64 = NULL; g_autoptr(virStorageSource) bitmapSourceChain = NULL; if (qemuTestDriverInit(&driver) < 0) @@ -885,6 +886,11 @@ mymain(void) diskxmljsondata.qemuCaps = caps_x86_64; imagecreatedata.qemuCaps = caps_x86_64; + if (!(qmp_schema_x86_64 = testQEMUSchemaLoad())) { + ret = -1; + goto cleanup; + } + virTestCounterReset("qemu storage source xml->json->xml "); #define TEST_JSON_FORMAT(tpe, xmlstr) \ @@ -983,10 +989,7 @@ mymain(void) #define TEST_DISK_TO_JSON(nme) TEST_DISK_TO_JSON_FULL(nme, false) - if (!(diskxmljsondata.schema = testQEMUSchemaLoad())) { - ret = -1; - goto cleanup; - } + diskxmljsondata.schema = qmp_schema_x86_64; if (virQEMUQAPISchemaPathGet("blockdev-add/arg-type", diskxmljsondata.schema, @@ -1045,7 +1048,9 @@ mymain(void) &imagecreatedata) < 0) \ ret = -1; \ } while (0) - imagecreatedata.schema = diskxmljsondata.schema; + + imagecreatedata.schema = qmp_schema_x86_64; + if (virQEMUQAPISchemaPathGet("blockdev-create/arg-type/options", imagecreatedata.schema, &imagecreatedata.schemaroot) < 0 || @@ -1198,7 +1203,6 @@ mymain(void) TEST_BITMAP_BLOCKCOPY("snapshots-deep", false, "snapshots"); cleanup: - virHashFree(diskxmljsondata.schema); qemuTestDriverFree(&driver); VIR_FREE(capslatest_x86_64); virObjectUnref(caps_x86_64); -- 2.25.1