From 6523a7ea5df91811303ea4cafa149049f9d37a87 Mon Sep 17 00:00:00 2001 From: Collin Walling Date: Thu, 20 Feb 2020 17:01:46 -0500 Subject: [PATCH] qemumonitorjsontest: load schema based on specified arch There are some architectures that support capabilities that others do not (e.g. s390x supports cpu comparison and baseline via QEMU). Let's make testQEMUSchemaLoad accept a string to specify the schema to load based on the specified arch. Signed-off-by: Collin Walling Reviewed-by: Michal Privoznik --- tests/qemublocktest.c | 2 +- tests/qemuhotplugtest.c | 2 +- tests/qemumonitorjsontest.c | 4 ++-- tests/testutilsqemuschema.c | 8 ++++---- tests/testutilsqemuschema.h | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 5a564b71df..7b7948d4c6 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -981,7 +981,7 @@ mymain(void) #define TEST_DISK_TO_JSON(nme) TEST_DISK_TO_JSON_FULL(nme, false) - if (!(diskxmljsondata.schema = testQEMUSchemaLoad())) { + if (!(diskxmljsondata.schema = testQEMUSchemaLoad("x86_64"))) { ret = -1; goto cleanup; } diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 6a3e61c54b..9dd42664cd 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -620,7 +620,7 @@ mymain(void) if (!(driver.domainEventState = virObjectEventStateNew())) return EXIT_FAILURE; - if (!(qmpschema = testQEMUSchemaLoad())) { + if (!(qmpschema = testQEMUSchemaLoad("x86_64"))) { VIR_TEST_VERBOSE("failed to load qapi schema\n"); return EXIT_FAILURE; } diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 24e0ce15ed..cd7fa1f41d 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2995,7 +2995,7 @@ mymain(void) virEventRegisterDefaultImpl(); - if (!(qapiData.schema = testQEMUSchemaLoad())) { + if (!(qapiData.schema = testQEMUSchemaLoad("x86_64"))) { VIR_TEST_VERBOSE("failed to load qapi schema"); ret = -1; goto cleanup; @@ -3232,7 +3232,7 @@ mymain(void) DO_TEST_QAPI_VALIDATE("alternate 2", "blockdev-add/arg-type", false, "{\"driver\":\"qcow2\",\"file\": 1234}"); - if (!(metaschema = testQEMUSchemaGetLatest()) || + if (!(metaschema = testQEMUSchemaGetLatest("x86_64")) || !(metaschemastr = virJSONValueToString(metaschema, false))) { VIR_TEST_VERBOSE("failed to load latest qapi schema"); ret = -1; diff --git a/tests/testutilsqemuschema.c b/tests/testutilsqemuschema.c index 9a1b1fea07..7b82ff27b2 100644 --- a/tests/testutilsqemuschema.c +++ b/tests/testutilsqemuschema.c @@ -524,7 +524,7 @@ testQEMUSchemaValidate(virJSONValuePtr obj, * replies file used for qemucapabilitiestest for the x86_64 architecture. */ virJSONValuePtr -testQEMUSchemaGetLatest(void) +testQEMUSchemaGetLatest(const char* arch) { char *capsLatestFile = NULL; char *capsLatest = NULL; @@ -533,7 +533,7 @@ testQEMUSchemaGetLatest(void) virJSONValuePtr reply = NULL; virJSONValuePtr schema = NULL; - if (!(capsLatestFile = testQemuGetLatestCapsForArch("x86_64", "replies"))) { + if (!(capsLatestFile = testQemuGetLatestCapsForArch(arch, "replies"))) { VIR_TEST_VERBOSE("failed to find latest caps replies"); return NULL; } @@ -575,11 +575,11 @@ testQEMUSchemaGetLatest(void) virHashTablePtr -testQEMUSchemaLoad(void) +testQEMUSchemaLoad(const char* arch) { virJSONValuePtr schema; - if (!(schema = testQEMUSchemaGetLatest())) + if (!(schema = testQEMUSchemaGetLatest(arch))) return NULL; return virQEMUQAPISchemaConvert(schema); diff --git a/tests/testutilsqemuschema.h b/tests/testutilsqemuschema.h index de9da7cb97..84ee9a9670 100644 --- a/tests/testutilsqemuschema.h +++ b/tests/testutilsqemuschema.h @@ -29,7 +29,7 @@ testQEMUSchemaValidate(virJSONValuePtr obj, virBufferPtr debug); virJSONValuePtr -testQEMUSchemaGetLatest(void); +testQEMUSchemaGetLatest(const char* arch); virHashTablePtr -testQEMUSchemaLoad(void); +testQEMUSchemaLoad(const char* arch); -- GitLab