[PATCH 2/3] qemuagenttest: Check invalid response in shutdown test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The shutdown test utilizes waiting for condition to exit the test. This
addition will return an error for the shutdown command to see if the
condition waiting code will not hang.
---
 tests/qemuagenttest.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c
index e0df297..f889b93 100644
--- a/tests/qemuagenttest.c
+++ b/tests/qemuagenttest.c
@@ -324,6 +324,29 @@ testQemuAgentShutdown(const void *data)
                           QEMU_AGENT_SHUTDOWN_REBOOT) < 0)
         goto cleanup;

+    /* check negative response, so that we can verify that the agent breaks
+     * out from sleep */
+
+    if (qemuMonitorTestAddAgentSyncResponse(test) < 0)
+        goto cleanup;
+
+    if (qemuMonitorTestAddItem(test, "guest-shutdown",
+                               "{\"error\":"
+                               "    {\"class\":\"CommandDisabled\","
+                               "     \"desc\":\"The command guest-shutdown has "
+                                               "been disabled for this instance\","
+                               "     \"data\":{\"name\":\"guest-shutdown\"}"
+                               "    }"
+                               "}") < 0)
+        goto cleanup;
+
+    if (qemuAgentShutdown(qemuMonitorTestGetAgent(test),
+                          QEMU_AGENT_SHUTDOWN_REBOOT) != -1) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       "agent shutdown command should have failed");
+        goto cleanup;
+    }
+
     ret = 0;

 cleanup:
-- 
1.8.3.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]