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@xxxxxxxxxx> --- tests/qemucapabilitiestest.c | 2 +- tests/qemumonitortestutils.c | 6 +++++- tests/qemumonitortestutils.h | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c index 3b0463a..32e2147 100644 --- a/tests/qemucapabilitiestest.c +++ b/tests/qemucapabilitiestest.c @@ -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()) || diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 626e37c..07da91c 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -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 (virtTestLoadFile(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; diff --git a/tests/qemumonitortestutils.h b/tests/qemumonitortestutils.h index c420737..8e2f371 100644 --- a/tests/qemumonitortestutils.h +++ b/tests/qemumonitortestutils.h @@ -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); -- 2.8.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list