mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemuMonitorJSONTestAttachOneChardev: Rewrite using qemuMonitorTestAddItemVerbatim
'qemuMonitorTestAddItemExpect' doesn't do QMP schema validation. Since it's the only use we can reimplement it using 'qemuMonitorTestAddItemVerbatim' which does schema validation and remove the old code instead. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
9482098395
commit
e79ccbae1c
@ -618,9 +618,18 @@ testQemuMonitorJSONAttachChardev(const void *opaque)
|
|||||||
|
|
||||||
if (data->expectargs) {
|
if (data->expectargs) {
|
||||||
g_autofree char *jsonreply = g_strdup_printf("{\"return\": {%s}}", NULLSTR_EMPTY(data->reply));
|
g_autofree char *jsonreply = g_strdup_printf("{\"return\": {%s}}", NULLSTR_EMPTY(data->reply));
|
||||||
|
g_autofree char *jsoncommand = NULL;
|
||||||
|
char *n;
|
||||||
|
|
||||||
if (qemuMonitorTestAddItemExpect(test, "chardev-add",
|
jsoncommand = g_strdup_printf("{\"execute\": \"chardev-add\", \"arguments\": %s, \"id\" : \"libvirt-1\"}", data->expectargs);
|
||||||
data->expectargs, true, jsonreply) < 0)
|
|
||||||
|
/* data->expectargs has ' instead of " */
|
||||||
|
for (n = jsoncommand; *n; n++) {
|
||||||
|
if (*n == '\'')
|
||||||
|
*n = '"';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (qemuMonitorTestAddItemVerbatim(test, jsoncommand, NULL, jsonreply) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user