tests: Allow QMP schema testing in qemuMonitorTestNewFromFileFull

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Peter Krempa 2019-06-07 13:53:45 +02:00
parent 56c2f2b45b
commit 1a77e0032b
4 changed files with 10 additions and 5 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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;

View File

@ -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);