[PATCH 17/18] qemumonitorjsontest: Test qemuMonitorJSONGetTargetArch

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

 



Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 tests/qemumonitorjsontest.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 9e9dbcc..5636fb6 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1862,6 +1862,43 @@ cleanup:
 }
 
 static int
+testQemuMonitorJSONqemuMonitorJSONGetTargetArch(const void *data)
+{
+    virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
+    qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+    int ret = -1;
+    char *arch;
+
+    if (!test)
+        return -1;
+
+    if (qemuMonitorTestAddItem(test, "query-target",
+                               "{"
+                               "    \"return\": {"
+                               "        \"arch\": \"x86_64\""
+                               "    },"
+                               "    \"id\": \"libvirt-21\""
+                               "}") < 0)
+        goto cleanup;
+
+    if (!(arch = qemuMonitorJSONGetTargetArch(qemuMonitorTestGetMonitor(test))))
+        goto cleanup;
+
+    if (STRNEQ(arch, "x86_64")) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "Unexpected architecture %s, expecting x86_64",
+                       arch);
+        goto cleanup;
+    }
+
+    ret = 0;
+cleanup:
+    VIR_FREE(arch);
+    qemuMonitorTestFree(test);
+    return ret;
+}
+
+static int
 mymain(void)
 {
     int ret = 0;
@@ -1955,6 +1992,7 @@ mymain(void)
     DO_TEST(qemuMonitorJSONGetPtyPaths);
     DO_TEST(qemuMonitorJSONSendKey);
     DO_TEST(qemuMonitorJSONSetBlockIoThrottle);
+    DO_TEST(qemuMonitorJSONGetTargetArch);
 
     virObjectUnref(xmlopt);
 
-- 
1.8.1.5

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