提交 7f350f52 编写于 作者: P Peter Krempa

qemuMonitorTestProcessCommandDefaultValidate: Use testQEMUSchemaValidateCommand

Remove the ad-hoc command validation in favor of the new helper.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 23bd18dc
......@@ -537,9 +537,6 @@ qemuMonitorTestProcessCommandDefaultValidate(qemuMonitorTestPtr test,
virJSONValuePtr args)
{
g_auto(virBuffer) debug = VIR_BUFFER_INITIALIZER;
virJSONValuePtr schemaroot;
g_autoptr(virJSONValue) emptyargs = NULL;
g_autofree char *schemapath = NULL;
if (!test->qapischema)
return 0;
......@@ -555,20 +552,13 @@ qemuMonitorTestProcessCommandDefaultValidate(qemuMonitorTestPtr test,
if (STREQ(cmdname, "device_add"))
return 0;
schemapath = g_strdup_printf("%s/arg-type", cmdname);
if (virQEMUQAPISchemaPathGet(schemapath, test->qapischema, &schemaroot) < 0 ||
!schemaroot) {
qemuMonitorTestError("command '%s' not found in QAPI schema", cmdname);
return -1;
}
if (testQEMUSchemaValidateCommand(cmdname, args, test->qapischema, &debug) < 0) {
if (virTestGetDebug() == 2) {
g_autofree char *argstr = NULL;
if (!args)
args = emptyargs = virJSONValueNewObject();
if (args)
argstr = virJSONValueToString(args, true);
if (testQEMUSchemaValidate(args, schemaroot, test->qapischema, &debug) < 0) {
if (virTestGetDebug() == 2) {
g_autofree char *argstr = virJSONValueToString(args, true);
fprintf(stderr,
"\nfailed to validate arguments of '%s' against QAPI schema\n"
"args:\n%s\nvalidator output:\n %s\n",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册