[libvirt] [PATCH 3/4] tests: Allow QMP schema testing in qemuMonitorTestNewFromFileFull

Peter Krempa pkrempa at redhat.com
Fri Jun 7 12:01:18 UTC 2019


Pass in the schema data from the caller if QMP schema testing is
desired.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 tests/qemucapabilitiestest.c | 3 ++-
 tests/qemuhotplugtest.c      | 2 +-
 tests/qemumonitortestutils.c | 7 +++++--
 tests/qemumonitortestutils.h | 3 ++-
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c
index ac9ab6bfce..67f57a4fdc 100644
--- a/tests/qemucapabilitiestest.c
+++ b/tests/qemucapabilitiestest.c
@@ -82,7 +82,8 @@ testQemuCaps(const void *opaque)
                     data->dataDir, data->base, data->archName) < 0)
         goto cleanup;

-    if (!(mon = qemuMonitorTestNewFromFileFull(repliesFile, &data->driver, NULL)))
+    if (!(mon = qemuMonitorTestNewFromFileFull(repliesFile, &data->driver, NULL,
+                                               NULL)))
         goto cleanup;

     if (qemuProcessQMPInitMonitor(qemuMonitorTestGetMonitor(mon)) < 0)
diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index fbf488c54c..08f00b9c72 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -435,7 +435,7 @@ testQemuHotplugCpuPrepare(const char *test,
         virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS);

     if (!(data->mon = qemuMonitorTestNewFromFileFull(data->file_json_monitor,
-                                                     &driver, data->vm)))
+                                                     &driver, data->vm, NULL)))
         goto error;

     priv->mon = qemuMonitorTestGetMonitor(data->mon);
diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index 0de9048243..8d7c503c6e 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -1396,6 +1396,7 @@ qemuMonitorTestFullAddItem(qemuMonitorTestPtr test,
  * @fileName: File name to load monitor replies from
  * @driver: qemu driver object
  * @vm: domain object (may be null if it's not needed by the test)
+ * @qmpschema: QMP schema data hash table if QMP checking is required
  *
  * Create a JSON test monitor simulator object and fill it with expected command
  * sequence and replies specified in @fileName.
@@ -1409,7 +1410,8 @@ qemuMonitorTestFullAddItem(qemuMonitorTestPtr test,
 qemuMonitorTestPtr
 qemuMonitorTestNewFromFileFull(const char *fileName,
                                virQEMUDriverPtr driver,
-                               virDomainObjPtr vm)
+                               virDomainObjPtr vm,
+                               virHashTablePtr qmpschema)
 {
     qemuMonitorTestPtr ret = NULL;
     char *jsonstr = NULL;
@@ -1423,7 +1425,8 @@ qemuMonitorTestNewFromFileFull(const char *fileName,
     if (virTestLoadFile(fileName, &jsonstr) < 0)
         return NULL;

-    if (!(ret = qemuMonitorTestNew(true, driver->xmlopt, vm, driver, NULL, NULL)))
+    if (!(ret = qemuMonitorTestNew(true, driver->xmlopt, vm, driver, NULL,
+                                   qmpschema)))
         goto cleanup;

     tmp = jsonstr;
diff --git a/tests/qemumonitortestutils.h b/tests/qemumonitortestutils.h
index d2520e08a4..8461c80caa 100644
--- a/tests/qemumonitortestutils.h
+++ b/tests/qemumonitortestutils.h
@@ -90,7 +90,8 @@ qemuMonitorTestPtr qemuMonitorTestNewFromFile(const char *fileName,
                                               bool simple);
 qemuMonitorTestPtr qemuMonitorTestNewFromFileFull(const char *fileName,
                                                   virQEMUDriverPtr driver,
-                                                  virDomainObjPtr vm);
+                                                  virDomainObjPtr vm,
+                                                  virHashTablePtr qmpschema);

 qemuMonitorTestPtr qemuMonitorTestNewAgent(virDomainXMLOptionPtr xmlopt);

-- 
2.21.0




More information about the libvir-list mailing list