[libvirt] [PATCH 15/18] qemumonitorjsontest: Test qemuMonitorJSONSendKey

Michal Privoznik mprivozn at redhat.com
Wed Oct 2 17:10:04 UTC 2013


Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 tests/qemumonitorjsontest.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 14c64fd..2c5c452 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1793,6 +1793,31 @@ cleanup:
 }
 
 static int
+testQemuMonitorJSONqemuMonitorJSONSendKey(const void *data)
+{
+    virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
+    qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+    int ret = -1;
+    unsigned int keycodes[] = {43, 26, 46, 46, 32};
+
+    if (!test)
+        return -1;
+
+    if (qemuMonitorTestAddItem(test, "send-key",
+                               "{\"return\": {}, \"id\": \"libvirt-16\"}") < 0)
+        goto cleanup;
+
+    if (qemuMonitorJSONSendKey(qemuMonitorTestGetMonitor(test),
+                               0, keycodes, ARRAY_CARDINALITY(keycodes)) < 0)
+        goto cleanup;
+
+    ret = 0;
+cleanup:
+    qemuMonitorTestFree(test);
+    return ret;
+}
+
+static int
 mymain(void)
 {
     int ret = 0;
@@ -1884,6 +1909,7 @@ mymain(void)
     DO_TEST(qemuMonitorJSONGetMigrationStatus);
     DO_TEST(qemuMonitorJSONGetSpiceMigrationStatus);
     DO_TEST(qemuMonitorJSONGetPtyPaths);
+    DO_TEST(qemuMonitorJSONSendKey);
 
     virObjectUnref(xmlopt);
 
-- 
1.8.1.5




More information about the libvir-list mailing list