]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemumonitorjsontest: Test qemuMonitorJSONSendKey
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 2 Oct 2013 16:23:17 +0000 (18:23 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 11 Oct 2013 08:24:48 +0000 (10:24 +0200)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
tests/qemumonitorjsontest.c

index 259b2c26eb942ab16e207632ffb3ce7856ded682..be8f477e98a0d53b0370efd02803920cbe11ec3a 100644 (file)
@@ -1933,6 +1933,31 @@ cleanup:
     return ret;
 }
 
+static int
+testQemuMonitorJSONqemuMonitorJSONSendKey(const void *data)
+{
+    virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
+    qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+    int ret = -1;
+    unsigned int keycodes[] = {43, 26, 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)
 {
@@ -2028,6 +2053,7 @@ mymain(void)
     DO_TEST(qemuMonitorJSONGetMigrationCapability);
     DO_TEST(qemuMonitorJSONGetCPUInfo);
     DO_TEST(qemuMonitorJSONGetVirtType);
+    DO_TEST(qemuMonitorJSONSendKey);
 
     virObjectUnref(xmlopt);