mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
tests: remove text monitor testing infrastructure
We removed testing for text monitor some time ago, remove the remains from the test infrastructure. Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
fba29dff83
commit
6d11c756f2
@ -126,13 +126,11 @@ qemuMonitorTestAddErrorResponse(qemuMonitorTestPtr test,
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
VIR_AUTOFREE(char *) escapemsg = NULL;
|
||||
VIR_AUTOFREE(char *) jsonmsg = NULL;
|
||||
const char *monmsg = NULL;
|
||||
char *tmp;
|
||||
|
||||
if (!usermsg)
|
||||
usermsg = "unexpected command";
|
||||
|
||||
if (test->json || test->agent) {
|
||||
virBufferEscape(&buf, '\\', "\"", "%s", usermsg);
|
||||
if (virBufferCheckError(&buf) < 0)
|
||||
return -1;
|
||||
@ -154,12 +152,7 @@ qemuMonitorTestAddErrorResponse(qemuMonitorTestPtr test,
|
||||
escapemsg) < 0)
|
||||
return -1;
|
||||
|
||||
monmsg = jsonmsg;
|
||||
} else {
|
||||
monmsg = usermsg;
|
||||
}
|
||||
|
||||
return qemuMonitorTestAddResponse(test, monmsg);
|
||||
return qemuMonitorTestAddResponse(test, jsonmsg);
|
||||
}
|
||||
|
||||
|
||||
@ -203,6 +196,7 @@ int ATTRIBUTE_FMT_PRINTF(2, 3)
|
||||
qemuMonitorReportError(qemuMonitorTestPtr test, const char *errmsg, ...)
|
||||
{
|
||||
va_list msgargs;
|
||||
VIR_AUTOFREE(char *) tmp = NULL;
|
||||
char *msg = NULL;
|
||||
char *jsonmsg = NULL;
|
||||
int ret = -1;
|
||||
@ -212,8 +206,6 @@ qemuMonitorReportError(qemuMonitorTestPtr test, const char *errmsg, ...)
|
||||
if (virVasprintf(&msg, errmsg, msgargs) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (test->agent || test->json) {
|
||||
VIR_AUTOFREE(char *) tmp = NULL;
|
||||
if (!(tmp = qemuMonitorEscapeArg(msg)))
|
||||
goto cleanup;
|
||||
|
||||
@ -222,10 +214,6 @@ qemuMonitorReportError(qemuMonitorTestPtr test, const char *errmsg, ...)
|
||||
" \"class\": \"UnexpectedCommand\" } }",
|
||||
tmp) < 0)
|
||||
goto cleanup;
|
||||
} else {
|
||||
if (virAsprintf(&jsonmsg, "error: '%s'", msg) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ret = qemuMonitorTestAddResponse(test, jsonmsg);
|
||||
|
||||
@ -600,13 +588,10 @@ qemuMonitorTestProcessCommandDefault(qemuMonitorTestPtr test,
|
||||
struct qemuMonitorTestHandlerData *data = item->opaque;
|
||||
virJSONValuePtr val = NULL;
|
||||
virJSONValuePtr cmdargs = NULL;
|
||||
char *cmdcopy = NULL;
|
||||
const char *cmdname;
|
||||
char *tmp;
|
||||
int ret = -1;
|
||||
int rc;
|
||||
|
||||
if (test->agent || test->json) {
|
||||
if (!(val = virJSONValueFromString(cmdstr)))
|
||||
return -1;
|
||||
|
||||
@ -616,21 +601,6 @@ qemuMonitorTestProcessCommandDefault(qemuMonitorTestPtr test,
|
||||
}
|
||||
|
||||
cmdargs = virJSONValueObjectGet(val, "arguments");
|
||||
} else {
|
||||
if (VIR_STRDUP(cmdcopy, cmdstr) < 0)
|
||||
return -1;
|
||||
|
||||
cmdname = cmdcopy;
|
||||
|
||||
if (!(tmp = strchr(cmdcopy, ' '))) {
|
||||
ret = qemuMonitorReportError(test,
|
||||
"Cannot find command name in '%s'",
|
||||
cmdstr);
|
||||
goto cleanup;
|
||||
}
|
||||
*tmp = '\0';
|
||||
}
|
||||
|
||||
if ((rc = qemuMonitorTestProcessCommandDefaultValidate(test, cmdname, cmdargs)) < 0)
|
||||
goto cleanup;
|
||||
|
||||
@ -646,7 +616,6 @@ qemuMonitorTestProcessCommandDefault(qemuMonitorTestPtr test,
|
||||
ret = qemuMonitorTestAddResponse(test, data->response);
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(cmdcopy);
|
||||
virJSONValueFree(val);
|
||||
return ret;
|
||||
}
|
||||
@ -689,7 +658,6 @@ qemuMonitorTestProcessCommandVerbatim(qemuMonitorTestPtr test,
|
||||
int rc;
|
||||
|
||||
/* JSON strings will be reformatted to simplify checking */
|
||||
if (test->json || test->agent) {
|
||||
if (!(json = virJSONValueFromString(cmdstr)) ||
|
||||
!(reformatted = virJSONValueToString(json, false)))
|
||||
return -1;
|
||||
@ -706,7 +674,6 @@ qemuMonitorTestProcessCommandVerbatim(qemuMonitorTestPtr test,
|
||||
if (rc == 1)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (STREQ(data->command_name, cmdstr)) {
|
||||
ret = qemuMonitorTestAddResponse(test, data->response);
|
||||
@ -756,11 +723,7 @@ qemuMonitorTestAddItemVerbatim(qemuMonitorTestPtr test,
|
||||
VIR_STRDUP(data->cmderr, cmderr) < 0)
|
||||
goto error;
|
||||
|
||||
if (test->json || test->agent)
|
||||
data->command_name = virJSONStringReformat(command, false);
|
||||
else
|
||||
ignore_value(VIR_STRDUP(data->command_name, command));
|
||||
|
||||
if (!data->command_name)
|
||||
goto error;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user