mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-31 00:45:18 +00:00
tests: Create simple monitor in qemuMonitorTestNewFromFile
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>
This commit is contained in:
parent
08529e1e27
commit
474e627892
@ -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()) ||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user