[libvirt] [PATCH 0/2] tests: qemumonitorjson: Fix blockstats test case

Peter Krempa (2): tests: qemumonitorjson: Add only required replies for blockstats test tests: qemumonitorjson: Fix name and call apropriate API tests/qemumonitorjsontest.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) -- 2.16.2

testQemuMonitorJSONqemuMonitorJSONGetBlockStatsInfo added 4 replies but only one was used. Additionally the comment stated that 7 replies are going to be added. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemumonitorjsontest.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 2eefd06b6e..7da362bbf3 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1772,11 +1772,7 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockStatsInfo(const void *data) if (!test) return -1; - /* fill in seven times - we are gonna ask seven times later on */ - if (qemuMonitorTestAddItem(test, "query-blockstats", reply) < 0 || - qemuMonitorTestAddItem(test, "query-blockstats", reply) < 0 || - qemuMonitorTestAddItem(test, "query-blockstats", reply) < 0 || - qemuMonitorTestAddItem(test, "query-blockstats", reply) < 0) + if (qemuMonitorTestAddItem(test, "query-blockstats", reply) < 0) goto cleanup; #define CHECK0FULL(var, value, varformat, valformat) \ -- 2.16.2

Call the internal version of qemuMonitorGetAllBlockStatsInfo API and rename the test accordingly. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tests/qemumonitorjsontest.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 7da362bbf3..c85bcbfc3b 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1674,7 +1674,7 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockInfo(const void *data) } static int -testQemuMonitorJSONqemuMonitorJSONGetBlockStatsInfo(const void *data) +testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInfo(const void *data) { virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data; qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt); @@ -1772,6 +1772,9 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockStatsInfo(const void *data) if (!test) return -1; + if (!(blockstats = virHashCreate(10, virHashValueFree))) + goto cleanup; + if (qemuMonitorTestAddItem(test, "query-blockstats", reply) < 0) goto cleanup; @@ -1805,13 +1808,13 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockStatsInfo(const void *data) CHECK0FULL(wr_highest_offset, WR_HIGHEST_OFFSET, "%llu", "%llu") \ CHECK0FULL(wr_highest_offset_valid, WR_HIGHEST_OFFSET_VALID, "%d", "%d") - if (qemuMonitorGetAllBlockStatsInfo(qemuMonitorTestGetMonitor(test), - &blockstats, false) < 0) + if (qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitorTestGetMonitor(test), + blockstats, false) < 0) goto cleanup; if (!blockstats) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - "qemuMonitorJSONGetBlockStatsInfo didn't return stats"); + "qemuMonitorJSONGetAllBlockStatsInfo didn't return stats"); goto cleanup; } @@ -2972,7 +2975,7 @@ mymain(void) DO_TEST_GEN(qemuMonitorJSONDetachCharDev); DO_TEST(qemuMonitorJSONGetBalloonInfo); DO_TEST(qemuMonitorJSONGetBlockInfo); - DO_TEST(qemuMonitorJSONGetBlockStatsInfo); + DO_TEST(qemuMonitorJSONGetAllBlockStatsInfo); DO_TEST(qemuMonitorJSONGetMigrationCacheSize); DO_TEST(qemuMonitorJSONGetMigrationStats); DO_TEST(qemuMonitorJSONGetChardevInfo); -- 2.16.2

On 06/27/2018 02:06 PM, Peter Krempa wrote:
Peter Krempa (2): tests: qemumonitorjson: Add only required replies for blockstats test tests: qemumonitorjson: Fix name and call apropriate API
tests/qemumonitorjsontest.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
ACK Michal
participants (2)
-
Michal Prívozník
-
Peter Krempa