]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
tests: Learn qemuMonitorTestNew optional greeting
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 19 Sep 2013 11:56:30 +0000 (13:56 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 1 Oct 2013 08:48:47 +0000 (10:48 +0200)
Currently, when creating a new mocked monitor, the greeting can't be
chosen. This is crucial for next patches, because some info as qemu
version is obtained in the greeting message.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
tests/qemuhotplugtest.c
tests/qemumonitortestutils.c
tests/qemumonitortestutils.h

index 89480afc5451f7c315898bc1ea77fa75af7cf459..5148a21223be106b43275d27655f23fdeaa1d153 100644 (file)
@@ -250,7 +250,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(true, driver.xmlopt, vm, &driver, NULL)))
         goto cleanup;
 
     tmp = test->mon;
index bca338541c6181f0fa3a5ce87c2abc0ccad7e212..f38cce664121bd896c55ef7207e0514bbc35ddfd 100644 (file)
@@ -873,7 +873,8 @@ qemuMonitorTestPtr
 qemuMonitorTestNew(bool json,
                    virDomainXMLOptionPtr xmlopt,
                    virDomainObjPtr vm,
-                   virQEMUDriverPtr driver)
+                   virQEMUDriverPtr driver,
+                   const char *greeting)
 {
     qemuMonitorTestPtr test = NULL;
     virDomainChrSourceDef src;
@@ -893,9 +894,10 @@ qemuMonitorTestNew(bool json,
 
     virObjectLock(test->mon);
 
-    if (qemuMonitorTestAddReponse(test, json ?
-                                  QEMU_JSON_GREETING :
-                                  QEMU_TEXT_GREETING) < 0)
+    if (!greeting)
+        greeting = json ? QEMU_JSON_GREETING : QEMU_TEXT_GREETING;
+
+    if (qemuMonitorTestAddReponse(test, greeting) < 0)
         goto error;
 
     if (qemuMonitorCommonTestInit(test) < 0)
index 9e39795d93ca97d43bbd1db75a4f23e761203d76..3f07f65575c526e11e1f91b434bccdf8fe7c0a58 100644 (file)
@@ -61,12 +61,13 @@ int qemuMonitorTestAddItemParams(qemuMonitorTestPtr test,
     ATTRIBUTE_SENTINEL;
 
 # define qemuMonitorTestNewSimple(json, xmlopt) \
-    qemuMonitorTestNew(json, xmlopt, NULL, NULL)
+    qemuMonitorTestNew(json, xmlopt, NULL, NULL, NULL)
 
 qemuMonitorTestPtr qemuMonitorTestNew(bool json,
                                       virDomainXMLOptionPtr xmlopt,
                                       virDomainObjPtr vm,
-                                      virQEMUDriverPtr driver);
+                                      virQEMUDriverPtr driver,
+                                      const char *greeting);
 
 qemuMonitorTestPtr qemuMonitorTestNewAgent(virDomainXMLOptionPtr xmlopt);