#define LIBVIRT_QEMU_PROCESSPRIV_H_ALLOW
#include "qemu/qemu_processpriv.h"
+#define LIBVIRT_VIRCOMMANDPRIV_H_ALLOW
+#include "util/vircommandpriv.h"
+
#include "testutilsqemu.h"
#define VIR_FROM_THIS VIR_FROM_QEMU
};
static int
-testCompareXMLToArgvValidateSchemaCommand(GStrv args,
- GHashTable *schema)
+testCompareXMLToArgvValidateSchema(virCommand *cmd,
+ testQemuInfo *info)
{
- GStrv arg;
+ char **args;
+ size_t nargs;
+ size_t a;
+
+ if (!info->qmpSchema)
+ return 0;
- for (arg = args; *arg; arg++) {
- const char *curcommand = *arg;
- const char *curargs = *(arg + 1);
+ virCommandArgListAccess(cmd, &args, &nargs);
+
+ for (a = 0; a < nargs; a++) {
+ const char *curcommand = args[a];
+ const char *curargs = NULL;
size_t i;
+ if (a + 1 < nargs)
+ curargs = args[a + 1];
+
for (i = 0; i < G_N_ELEMENTS(commands); i++) {
const struct testValidateSchemaCommandData *command = commands + i;
g_auto(virBuffer) debug = VIR_BUFFER_INITIALIZER;
}
if (*curargs != '{') {
- arg++;
+ a++;
break;
}
return -1;
if (testQEMUSchemaValidateCommand(command->schema, jsonargs,
- schema, false, false,
+ info->qmpSchema, false, false,
command->allowIncomplete,
&debug) < 0) {
VIR_TEST_VERBOSE("failed to validate '%s %s' against QAPI schema: %s",
return -1;
}
- arg++;
+ a++;
}
}
}
-static int
-testCompareXMLToArgvValidateSchema(virCommand *cmd,
- testQemuInfo *info)
-{
- g_auto(GStrv) args = NULL;
-
- if (!info->qmpSchema)
- return 0;
-
- if (virCommandGetArgList(cmd, &args) < 0)
- return -1;
-
- if (testCompareXMLToArgvValidateSchemaCommand(args, info->qmpSchema) < 0)
- return -1;
-
- return 0;
-}
-
-
static int
testInfoCheckDuplicate(testQemuInfo *info)
{