mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemumonitorjsontest: Test qemuMonitorJSONGetBalloonInfo
This commit is contained in:
parent
3e8343e151
commit
50dc5a398b
@ -1037,6 +1037,42 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@ -1086,6 +1122,7 @@ mymain(void)
|
||||
DO_TEST_SIMPLE("inject-nmi", qemuMonitorJSONInjectNMI);
|
||||
DO_TEST_SIMPLE("system_wakeup", qemuMonitorJSONSystemWakeup);
|
||||
DO_TEST_SIMPLE("nbd-server-stop", qemuMonitorJSONNBDServerStop);
|
||||
DO_TEST(qemuMonitorJSONGetBalloonInfo);
|
||||
|
||||
virObjectUnref(xmlopt);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user