提交 ce01ec42 编写于 作者: P Peter Krempa

qemuagenttest: Test arbitrary command passthrough

Exercise the arbitrary command passthrough API.
上级 4ce91f6e
......@@ -474,6 +474,50 @@ cleanup:
}
static const char testQemuAgentArbitraryCommandResponse[] =
"{\"return\":\"bla\"}";
static int
testQemuAgentArbitraryCommand(const void *data)
{
virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
qemuMonitorTestPtr test = qemuMonitorTestNewAgent(xmlopt);
int ret = -1;
char *reply = NULL;
if (!test)
return -1;
if (qemuMonitorTestAddAgentSyncResponse(test) < 0)
goto cleanup;
if (qemuMonitorTestAddItem(test, "ble",
testQemuAgentArbitraryCommandResponse) < 0)
goto cleanup;
if (qemuAgentArbitraryCommand(qemuMonitorTestGetAgent(test),
"{\"execute\":\"ble\"}",
&reply,
VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK) < 0)
goto cleanup;
if (STRNEQ(reply, testQemuAgentArbitraryCommandResponse)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"invalid processing of guest agent reply: "
"got '%s' expected '%s'",
reply, testQemuAgentArbitraryCommandResponse);
goto cleanup;
}
ret = 0;
cleanup:
VIR_FREE(reply);
qemuMonitorTestFree(test);
return ret;
}
static int
mymain(void)
{
......@@ -501,6 +545,7 @@ mymain(void)
DO_TEST(Suspend);
DO_TEST(Shutdown);
DO_TEST(CPU);
DO_TEST(ArbitraryCommand);
virObjectUnref(xmlopt);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册