]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemumonitorjsontest: Test qemuMonitorJSONGetMigrationCacheSize
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 2 Oct 2013 14:01:46 +0000 (16:01 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 3 Oct 2013 09:29:56 +0000 (11:29 +0200)
tests/qemumonitorjsontest.c

index 5b26581b497de7b56ca73c3002d22dc60959a749..63d389a844f0342f82caf35739cbeaeceb066293 100644 (file)
@@ -1426,6 +1426,42 @@ cleanup:
     return ret;
 }
 
+static int
+testQemuMonitorJSONqemuMonitorJSONGetMigrationCacheSize(const void *data)
+{
+    virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
+    qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+    int ret = -1;
+    unsigned long long cacheSize;
+
+    if (!test)
+        return -1;
+
+    if (qemuMonitorTestAddItem(test, "query-migrate-cache-size",
+                               "{"
+                               "    \"return\": 67108864,"
+                               "    \"id\": \"libvirt-12\""
+                               "}") < 0)
+        goto cleanup;
+
+    if (qemuMonitorJSONGetMigrationCacheSize(qemuMonitorTestGetMonitor(test),
+                                             &cacheSize) < 0)
+        goto cleanup;
+
+    if (cacheSize != 67108864) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "Invalid cacheSize: %llu, expected 67108864",
+                       cacheSize);
+        goto cleanup;
+    }
+
+    ret = 0;
+
+cleanup:
+    qemuMonitorTestFree(test);
+    return ret;
+}
+
 static int
 mymain(void)
 {
@@ -1478,6 +1514,7 @@ mymain(void)
     DO_TEST(qemuMonitorJSONGetBalloonInfo);
     DO_TEST(qemuMonitorJSONGetBlockInfo);
     DO_TEST(qemuMonitorJSONGetBlockStatsInfo);
+    DO_TEST(qemuMonitorJSONGetMigrationCacheSize);
 
     virObjectUnref(xmlopt);