diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c index 7724df2742..7d8c66707d 100644 --- a/tests/qemuagenttest.c +++ b/tests/qemuagenttest.c @@ -475,10 +475,9 @@ testQemuAgentShutdown(const void *data) priv.event = QEMU_AGENT_EVENT_SHUTDOWN; priv.mode = "halt"; - if (qemuMonitorTestAddHandler(test, "guest-shutdown", - qemuAgentShutdownTestMonitorHandler, - &priv, NULL) < 0) - return -1; + qemuMonitorTestAddHandler(test, "guest-shutdown", + qemuAgentShutdownTestMonitorHandler, + &priv, NULL); if (qemuAgentShutdown(qemuMonitorTestGetAgent(test), QEMU_AGENT_SHUTDOWN_HALT) < 0) @@ -487,10 +486,9 @@ testQemuAgentShutdown(const void *data) priv.event = QEMU_AGENT_EVENT_SHUTDOWN; priv.mode = "powerdown"; - if (qemuMonitorTestAddHandler(test, "guest-shutdown", - qemuAgentShutdownTestMonitorHandler, - &priv, NULL) < 0) - return -1; + qemuMonitorTestAddHandler(test, "guest-shutdown", + qemuAgentShutdownTestMonitorHandler, + &priv, NULL); if (qemuAgentShutdown(qemuMonitorTestGetAgent(test), QEMU_AGENT_SHUTDOWN_POWERDOWN) < 0) @@ -499,11 +497,10 @@ testQemuAgentShutdown(const void *data) priv.event = QEMU_AGENT_EVENT_RESET; priv.mode = "reboot"; - if (qemuMonitorTestAddHandler(test, - "guest-shutdown", - qemuAgentShutdownTestMonitorHandler, - &priv, NULL) < 0) - return -1; + qemuMonitorTestAddHandler(test, + "guest-shutdown", + qemuAgentShutdownTestMonitorHandler, + &priv, NULL); if (qemuAgentShutdown(qemuMonitorTestGetAgent(test), QEMU_AGENT_SHUTDOWN_REBOOT) < 0) @@ -691,10 +688,9 @@ testQemuAgentTimeout(const void *data) if (virTestGetExpensive() == 0) return EXIT_AM_SKIP; - if (qemuMonitorTestAddHandler(test, NULL, - qemuAgentTimeoutTestMonitorHandler, - NULL, NULL) < 0) - return -1; + qemuMonitorTestAddHandler(test, NULL, + qemuAgentTimeoutTestMonitorHandler, + NULL, NULL); if (qemuAgentFSFreeze(qemuMonitorTestGetAgent(test), NULL, 0) != -1) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -706,11 +702,10 @@ testQemuAgentTimeout(const void *data) if (qemuMonitorTestAddAgentSyncResponse(test) < 0) return -1; - if (qemuMonitorTestAddHandler(test, - NULL, - qemuAgentTimeoutTestMonitorHandler, - NULL, NULL) < 0) - return -1; + qemuMonitorTestAddHandler(test, + NULL, + qemuAgentTimeoutTestMonitorHandler, + NULL, NULL); if (qemuAgentArbitraryCommand(qemuMonitorTestGetAgent(test), "{\"execute\":\"ble\"}", diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index cfe78b258a..40ef057271 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -441,7 +441,7 @@ qemuMonitorTestFree(qemuMonitorTest *test) } -int +void qemuMonitorTestAddHandler(qemuMonitorTest *test, const char *identifier, qemuMonitorTestResponseCallback cb, @@ -460,8 +460,6 @@ qemuMonitorTestAddHandler(qemuMonitorTest *test, VIR_WITH_MUTEX_LOCK_GUARD(&test->lock) { VIR_APPEND_ELEMENT(test->items, test->nitems, item); } - - return 0; } void * @@ -604,10 +602,12 @@ qemuMonitorTestAddItem(qemuMonitorTest *test, data->command_name = g_strdup(command_name); data->response = g_strdup(response); - return qemuMonitorTestAddHandler(test, - command_name, - qemuMonitorTestProcessCommandDefault, - data, qemuMonitorTestHandlerDataFree); + qemuMonitorTestAddHandler(test, + command_name, + qemuMonitorTestProcessCommandDefault, + data, qemuMonitorTestHandlerDataFree); + + return 0; } @@ -684,10 +684,12 @@ qemuMonitorTestAddItemVerbatim(qemuMonitorTest *test, data->cmderr = g_strdup(cmderr); data->command_name = g_steal_pointer(&reformatted); - return qemuMonitorTestAddHandler(test, - command, - qemuMonitorTestProcessCommandVerbatim, - data, qemuMonitorTestHandlerDataFree); + qemuMonitorTestAddHandler(test, + command, + qemuMonitorTestProcessCommandVerbatim, + data, qemuMonitorTestHandlerDataFree); + + return 0; } @@ -732,10 +734,12 @@ qemuMonitorTestAddAgentSyncResponse(qemuMonitorTest *test) return -1; } - return qemuMonitorTestAddHandler(test, - "agent-sync", - qemuMonitorTestProcessGuestAgentSync, - NULL, NULL); + qemuMonitorTestAddHandler(test, + "agent-sync", + qemuMonitorTestProcessGuestAgentSync, + NULL, NULL); + + return 0; } @@ -841,10 +845,12 @@ qemuMonitorTestAddItemParams(qemuMonitorTest *test, va_end(args); - return qemuMonitorTestAddHandler(test, - cmdname, - qemuMonitorTestProcessCommandWithArgs, - data, qemuMonitorTestHandlerDataFree); + qemuMonitorTestAddHandler(test, + cmdname, + qemuMonitorTestProcessCommandWithArgs, + data, qemuMonitorTestHandlerDataFree); + + return 0; error: va_end(args); @@ -939,10 +945,12 @@ qemuMonitorTestAddItemExpect(qemuMonitorTest *test, } } - return qemuMonitorTestAddHandler(test, - cmdname, - qemuMonitorTestProcessCommandWithArgStr, - data, qemuMonitorTestHandlerDataFree); + qemuMonitorTestAddHandler(test, + cmdname, + qemuMonitorTestProcessCommandWithArgStr, + data, qemuMonitorTestHandlerDataFree); + + return 0; } diff --git a/tests/qemumonitortestutils.h b/tests/qemumonitortestutils.h index ffcb32a5cc..df0d544720 100644 --- a/tests/qemumonitortestutils.h +++ b/tests/qemumonitortestutils.h @@ -30,7 +30,7 @@ typedef int (*qemuMonitorTestResponseCallback)(qemuMonitorTest *test, qemuMonitorTestItem *item, const char *message); -int +void qemuMonitorTestAddHandler(qemuMonitorTest *test, const char *identifier, qemuMonitorTestResponseCallback cb,