]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: Create simple monitor in qemuMonitorTestNewFromFile
authorJiri Denemark <jdenemar@redhat.com>
Mon, 6 Jun 2016 14:55:05 +0000 (16:55 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 9 Jun 2016 07:47:56 +0000 (09:47 +0200)
The current version uses the first JSON reply from the file as monitor
greeting. With the new parameter the caller can now request a simple
test monitor to be created, which uses an artificial greeting and uses
all JSON strings from the file as regular replies.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
tests/qemucapabilitiestest.c
tests/qemumonitortestutils.c
tests/qemumonitortestutils.h

index 5a27b3624e637abc9092e16107bc740dd22f8dff..b98f775fd40a8b58b2d3dc8b49f45b39580097f5 100644 (file)
@@ -53,7 +53,7 @@ testQemuCaps(const void *opaque)
                     abs_srcdir, data->base, data->archName) < 0)
         goto cleanup;
 
-    if (!(mon = qemuMonitorTestNewFromFile(repliesFile, data->xmlopt)))
+    if (!(mon = qemuMonitorTestNewFromFile(repliesFile, data->xmlopt, false)))
         goto cleanup;
 
     if (!(capsActual = virQEMUCapsNew()) ||
index c04663e4c0c26b3c36cafe06e5a1614fe7a8b88d..c86a27adce8724d7b072205b3b6368621a63e455 100644 (file)
@@ -930,7 +930,8 @@ qemuMonitorTestNew(bool json,
 
 qemuMonitorTestPtr
 qemuMonitorTestNewFromFile(const char *fileName,
-                           virDomainXMLOptionPtr xmlopt)
+                           virDomainXMLOptionPtr xmlopt,
+                           bool simple)
 {
     qemuMonitorTestPtr test = NULL;
     char *json = NULL;
@@ -940,6 +941,9 @@ qemuMonitorTestNewFromFile(const char *fileName,
     if (virTestLoadFile(fileName, &json) < 0)
         goto cleanup;
 
+    if (simple && !(test = qemuMonitorTestNewSimple(true, xmlopt)))
+        goto cleanup;
+
     /* Our JSON parser expects replies to be separated by a newline character.
      * Hence we must preprocess the file a bit. */
     tmp = singleReply = json;
index c42073787aaf1c02513e12906e3fc69b127a755b..8e2f371d7b468acb1e950e1ec68a47da2d8d702e 100644 (file)
@@ -70,7 +70,8 @@ qemuMonitorTestPtr qemuMonitorTestNew(bool json,
                                       const char *greeting);
 
 qemuMonitorTestPtr qemuMonitorTestNewFromFile(const char *fileName,
-                                              virDomainXMLOptionPtr xmlopt);
+                                              virDomainXMLOptionPtr xmlopt,
+                                              bool simple);
 
 qemuMonitorTestPtr qemuMonitorTestNewAgent(virDomainXMLOptionPtr xmlopt);