Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- tests/qemumonitorjsontest.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 587b66f..ba2de45 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1214,6 +1214,42 @@ cleanup: } static int +testQemuMonitorJSONqemuMonitorJSONGetBalloonInfo(const void *data) +{ + virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data; + qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt); + int ret = -1; + unsigned long long currmem; + + if (!test) + return -1; + + if (qemuMonitorTestAddItem(test, "query-balloon", + "{" + " \"return\": {" + " \"actual\": 4294967296" + " }," + " \"id\": \"libvirt-9\"" + "}") < 0) + goto cleanup; + + if (qemuMonitorJSONGetBalloonInfo(qemuMonitorTestGetMonitor(test), &currmem) < 0) + goto cleanup; + + if (currmem != (4294967296/1024)) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "Unexpected currmem value: %llu", currmem); + goto cleanup; + } + + ret = 0; + +cleanup: + qemuMonitorTestFree(test); + return ret; +} + +static int mymain(void) { int ret = 0; @@ -1298,6 +1334,7 @@ mymain(void) DO_TEST_GEN(qemuMonitorJSONDetachCharDev); DO_TEST(qemuMonitorJSONGetCPUInfo); DO_TEST(qemuMonitorJSONGetVirtType); + DO_TEST(qemuMonitorJSONGetBalloonInfo); virObjectUnref(xmlopt); -- 1.8.1.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list