mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-06 20:00:05 +00:00
qemuagenttest: Test timeout of agent commands
If VIR_TEST_EXPENSIVE is enabled, test timeout of agent commands. This test takes 6 seconds to finish.
This commit is contained in:
parent
12f22856bf
commit
3ff6ae5b17
@ -518,6 +518,65 @@ cleanup:
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuAgentTimeoutTestMonitorHandler(qemuMonitorTestPtr test ATTRIBUTE_UNUSED,
|
||||
qemuMonitorTestItemPtr item ATTRIBUTE_UNUSED,
|
||||
const char *cmdstr ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
testQemuAgentTimeout(const void *data)
|
||||
{
|
||||
virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
|
||||
qemuMonitorTestPtr test = qemuMonitorTestNewAgent(xmlopt);
|
||||
char *reply = NULL;
|
||||
int ret = -1;
|
||||
|
||||
if (!test)
|
||||
return -1;
|
||||
|
||||
if (virTestGetExpensive() == 0)
|
||||
return EXIT_AM_SKIP;
|
||||
|
||||
if (qemuMonitorTestAddHandler(test, qemuAgentTimeoutTestMonitorHandler,
|
||||
NULL, NULL) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuAgentFSFreeze(qemuMonitorTestGetAgent(test)) != -1) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
"agent command should have failed");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* test timeout */
|
||||
if (qemuMonitorTestAddAgentSyncResponse(test) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuMonitorTestAddHandler(test, qemuAgentTimeoutTestMonitorHandler,
|
||||
NULL, NULL) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuAgentArbitraryCommand(qemuMonitorTestGetAgent(test),
|
||||
"{\"execute\":\"ble\"}",
|
||||
&reply,
|
||||
1) != -2) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
"agent command didn't time out");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(reply);
|
||||
qemuMonitorTestFree(test);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
mymain(void)
|
||||
{
|
||||
@ -546,6 +605,7 @@ mymain(void)
|
||||
DO_TEST(Shutdown);
|
||||
DO_TEST(CPU);
|
||||
DO_TEST(ArbitraryCommand);
|
||||
DO_TEST(Timeout);
|
||||
|
||||
virObjectUnref(xmlopt);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user