[libvirt] [PATCH 02/12] tests: always assume JSON in qemuMonitorTestNew

Ján Tomko jtomko at redhat.com
Sat Jun 15 11:54:00 UTC 2019


Now that all the callers call qemuMonitorTestNew with json=true,
remove the argument and always assume JSON.

Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 tests/qemuhotplugtest.c      |  2 +-
 tests/qemumonitortestutils.c | 15 ++++++---------
 tests/qemumonitortestutils.h |  7 +++----
 3 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index bfbf32baa4..b659565a48 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -280,7 +280,7 @@ testQemuHotplug(const void *data)
 
     /* Now is the best time to feed the spoofed monitor with predefined
      * replies. */
-    if (!(test_mon = qemuMonitorTestNew(true, driver.xmlopt, vm, &driver,
+    if (!(test_mon = qemuMonitorTestNew(driver.xmlopt, vm, &driver,
                                         NULL, NULL)))
         goto cleanup;
 
diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index 03261d649e..86883e682b 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -1241,11 +1241,8 @@ qemuMonitorCommonTestInit(qemuMonitorTestPtr test)
                             "}"
 /* We skip the normal handshake reply of "{\"execute\":\"qmp_capabilities\"}" */
 
-#define QEMU_TEXT_GREETING "QEMU 1.0,1 monitor - type 'help' for more information"
-
 qemuMonitorTestPtr
-qemuMonitorTestNew(bool json,
-                   virDomainXMLOptionPtr xmlopt,
+qemuMonitorTestNew(virDomainXMLOptionPtr xmlopt,
                    virDomainObjPtr vm,
                    virQEMUDriverPtr driver,
                    const char *greeting,
@@ -1259,11 +1256,11 @@ qemuMonitorTestNew(bool json,
     if (!(test = qemuMonitorCommonTestNew(xmlopt, vm, &src)))
         goto error;
 
-    test->json = json;
+    test->json = true;
     test->qapischema = schema;
     if (!(test->mon = qemuMonitorOpen(test->vm,
                                       &src,
-                                      json,
+                                      true,
                                       true,
                                       0,
                                       &qemuMonitorTestCallbacks,
@@ -1273,7 +1270,7 @@ qemuMonitorTestNew(bool json,
     virObjectLock(test->mon);
 
     if (!greeting)
-        greeting = json ? QEMU_JSON_GREETING : QEMU_TEXT_GREETING;
+        greeting = QEMU_JSON_GREETING;
 
     if (qemuMonitorTestAddResponse(test, greeting) < 0)
         goto error;
@@ -1340,7 +1337,7 @@ qemuMonitorTestNewFromFile(const char *fileName,
                     goto error;
             } else {
                 /* Create new mocked monitor with our greeting */
-                if (!(test = qemuMonitorTestNew(true, xmlopt, NULL, NULL,
+                if (!(test = qemuMonitorTestNew(xmlopt, NULL, NULL,
                                                 singleReply, NULL)))
                     goto error;
             }
@@ -1425,7 +1422,7 @@ qemuMonitorTestNewFromFileFull(const char *fileName,
     if (virTestLoadFile(fileName, &jsonstr) < 0)
         return NULL;
 
-    if (!(ret = qemuMonitorTestNew(true, driver->xmlopt, vm, driver, NULL,
+    if (!(ret = qemuMonitorTestNew(driver->xmlopt, vm, driver, NULL,
                                    qmpschema)))
         goto cleanup;
 
diff --git a/tests/qemumonitortestutils.h b/tests/qemumonitortestutils.h
index 23192c1223..3e93f9551a 100644
--- a/tests/qemumonitortestutils.h
+++ b/tests/qemumonitortestutils.h
@@ -75,12 +75,11 @@ int qemuMonitorTestAddItemExpect(qemuMonitorTestPtr test,
                                  const char *response);
 
 # define qemuMonitorTestNewSimple(xmlopt) \
-    qemuMonitorTestNew(true, xmlopt, NULL, NULL, NULL, NULL)
+    qemuMonitorTestNew(xmlopt, NULL, NULL, NULL, NULL)
 # define qemuMonitorTestNewSchema(xmlopt, schema) \
-    qemuMonitorTestNew(true, xmlopt, NULL, NULL, NULL, schema)
+    qemuMonitorTestNew(xmlopt, NULL, NULL, NULL, schema)
 
-qemuMonitorTestPtr qemuMonitorTestNew(bool json,
-                                      virDomainXMLOptionPtr xmlopt,
+qemuMonitorTestPtr qemuMonitorTestNew(virDomainXMLOptionPtr xmlopt,
                                       virDomainObjPtr vm,
                                       virQEMUDriverPtr driver,
                                       const char *greeting,
-- 
2.20.1




More information about the libvir-list mailing list