Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tests/qemumonitorjsontest.c | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 6eb26a1..587b66f 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1177,6 +1177,43 @@ cleanup:
}
static int
+testQemuMonitorJSONqemuMonitorJSONGetVirtType(const void *data)
+{
+ virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ int ret = -1;
+ int virtType;
+
+ if (!test)
+ return -1;
+
+ if (qemuMonitorTestAddItem(test, "query-kvm",
+ "{"
+ " \"return\": {"
+ " \"enabled\": true,"
+ " \"present\": true"
+ " },"
+ " \"id\": \"libvirt-8\""
+ "}") < 0)
+ goto cleanup;
+
+ if (qemuMonitorJSONGetVirtType(qemuMonitorTestGetMonitor(test), &virtType) <
0)
+ goto cleanup;
+
+ if (virtType != VIR_DOMAIN_VIRT_KVM) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "Unexpected virt type: %d", virtType);
+ goto cleanup;
+ }
+
+ ret = 0;
+
+cleanup:
+ qemuMonitorTestFree(test);
+ return ret;
+}
+
+static int
mymain(void)
{
int ret = 0;
@@ -1260,6 +1297,7 @@ mymain(void)
DO_TEST_GEN(qemuMonitorJSONNBDServerAdd);
DO_TEST_GEN(qemuMonitorJSONDetachCharDev);
DO_TEST(qemuMonitorJSONGetCPUInfo);
+ DO_TEST(qemuMonitorJSONGetVirtType);
virObjectUnref(xmlopt);
--
1.8.1.5