提交 1262cded 编写于 作者: P Peter Krempa

qemublocktest: Load QMP schema earlier

Multiple tests require the schema. Extract the loading into a separate
variable to avoid issues with ownership of the pointer.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 5179cc6b
...@@ -867,6 +867,7 @@ mymain(void) ...@@ -867,6 +867,7 @@ mymain(void)
struct testQemuBlockBitmapBlockcopyData blockbitmapblockcopydata; struct testQemuBlockBitmapBlockcopyData blockbitmapblockcopydata;
char *capslatest_x86_64 = NULL; char *capslatest_x86_64 = NULL;
virQEMUCapsPtr caps_x86_64 = NULL; virQEMUCapsPtr caps_x86_64 = NULL;
g_autoptr(virHashTable) qmp_schema_x86_64 = NULL;
g_autoptr(virStorageSource) bitmapSourceChain = NULL; g_autoptr(virStorageSource) bitmapSourceChain = NULL;
if (qemuTestDriverInit(&driver) < 0) if (qemuTestDriverInit(&driver) < 0)
...@@ -889,6 +890,11 @@ mymain(void) ...@@ -889,6 +890,11 @@ mymain(void)
diskxmljsondata.qemuCaps = caps_x86_64; diskxmljsondata.qemuCaps = caps_x86_64;
imagecreatedata.qemuCaps = caps_x86_64; imagecreatedata.qemuCaps = caps_x86_64;
if (!(qmp_schema_x86_64 = testQEMUSchemaLoad("x86_64"))) {
ret = -1;
goto cleanup;
}
virTestCounterReset("qemu storage source xml->json->xml "); virTestCounterReset("qemu storage source xml->json->xml ");
#define TEST_JSON_FORMAT(tpe, xmlstr) \ #define TEST_JSON_FORMAT(tpe, xmlstr) \
...@@ -987,10 +993,7 @@ mymain(void) ...@@ -987,10 +993,7 @@ mymain(void)
#define TEST_DISK_TO_JSON(nme) TEST_DISK_TO_JSON_FULL(nme, false) #define TEST_DISK_TO_JSON(nme) TEST_DISK_TO_JSON_FULL(nme, false)
if (!(diskxmljsondata.schema = testQEMUSchemaLoad("x86_64"))) { diskxmljsondata.schema = qmp_schema_x86_64;
ret = -1;
goto cleanup;
}
if (virQEMUQAPISchemaPathGet("blockdev-add/arg-type", if (virQEMUQAPISchemaPathGet("blockdev-add/arg-type",
diskxmljsondata.schema, diskxmljsondata.schema,
...@@ -1049,7 +1052,9 @@ mymain(void) ...@@ -1049,7 +1052,9 @@ mymain(void)
&imagecreatedata) < 0) \ &imagecreatedata) < 0) \
ret = -1; \ ret = -1; \
} while (0) } while (0)
imagecreatedata.schema = diskxmljsondata.schema;
imagecreatedata.schema = qmp_schema_x86_64;
if (virQEMUQAPISchemaPathGet("blockdev-create/arg-type/options", if (virQEMUQAPISchemaPathGet("blockdev-create/arg-type/options",
imagecreatedata.schema, imagecreatedata.schema,
&imagecreatedata.schemaroot) < 0 || &imagecreatedata.schemaroot) < 0 ||
...@@ -1202,7 +1207,6 @@ mymain(void) ...@@ -1202,7 +1207,6 @@ mymain(void)
TEST_BITMAP_BLOCKCOPY("snapshots-deep", false, "snapshots"); TEST_BITMAP_BLOCKCOPY("snapshots-deep", false, "snapshots");
cleanup: cleanup:
virHashFree(diskxmljsondata.schema);
qemuTestDriverFree(&driver); qemuTestDriverFree(&driver);
VIR_FREE(capslatest_x86_64); VIR_FREE(capslatest_x86_64);
virObjectUnref(caps_x86_64); virObjectUnref(caps_x86_64);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册