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@xxxxxxxxxx> --- tests/qemuhotplugtest.c | 2 +- tests/qemumonitortestutils.c | 10 ++++++---- tests/qemumonitortestutils.h | 5 +++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 89480af..5148a21 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -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; diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 486d72f..6400f27 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -872,7 +872,8 @@ qemuMonitorTestPtr qemuMonitorTestNew(bool json, virDomainXMLOptionPtr xmlopt, virDomainObjPtr vm, - virQEMUDriverPtr driver) + virQEMUDriverPtr driver, + const char *greeting) { qemuMonitorTestPtr test = NULL; virDomainChrSourceDef src; @@ -890,9 +891,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) diff --git a/tests/qemumonitortestutils.h b/tests/qemumonitortestutils.h index 9e39795..3f07f65 100644 --- a/tests/qemumonitortestutils.h +++ b/tests/qemumonitortestutils.h @@ -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); -- 1.8.1.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list