[PATCH 17/20] qemuagenttest: Add testing of agent suspend modes

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

 



---
 tests/qemuagenttest.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c
index a3b8834..d0b450e 100644
--- a/tests/qemuagenttest.c
+++ b/tests/qemuagenttest.c
@@ -162,6 +162,52 @@ cleanup:


 static int
+testQemuAgentSuspend(const void *data)
+{
+    virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
+    qemuMonitorTestPtr test = qemuMonitorTestNewAgent(xmlopt);
+    int ret = -1;
+    size_t i;
+
+    if (!test)
+        return -1;
+
+    if (qemuMonitorTestAddAgentSyncResponse(test) < 0)
+        goto cleanup;
+
+    if (qemuMonitorTestAddItem(test, "guest-suspend-ram",
+                               "{ \"return\" : {} }") < 0)
+        goto cleanup;
+
+    if (qemuMonitorTestAddAgentSyncResponse(test) < 0)
+        goto cleanup;
+
+    if (qemuMonitorTestAddItem(test, "guest-suspend-disk",
+                               "{ \"return\" : {} }") < 0)
+        goto cleanup;
+
+    if (qemuMonitorTestAddAgentSyncResponse(test) < 0)
+        goto cleanup;
+
+    if (qemuMonitorTestAddItem(test, "guest-suspend-hybrid",
+                               "{ \"return\" : {} }") < 0)
+        goto cleanup;
+
+    /* try the commands - fail if ordering changes */
+    for (i = 0; i < VIR_NODE_SUSPEND_TARGET_LAST; i++) {
+        if (qemuAgentSuspend(qemuMonitorTestGetAgent(test), i) < 0)
+            goto cleanup;
+    }
+
+    ret = 0;
+
+cleanup:
+    qemuMonitorTestFree(test);
+    return ret;
+}
+
+
+static int
 mymain(void)
 {
     int ret = 0;
@@ -185,6 +231,7 @@ mymain(void)
     DO_TEST(FSFreeze);
     DO_TEST(FSThaw);
     DO_TEST(FSTrim);
+    DO_TEST(Suspend);

     virObjectUnref(xmlopt);

-- 
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]