mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 18:45:16 +00:00
testCompareXMLToArgvValidateSchemaCommand: Add validation for '-device'
Now that we use JSON with -device we can validate it at least partially (since the schema for 'device_add' is for now incomplete) against the QMP schema. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
c9b13e0557
commit
6f34a991c7
@ -490,13 +490,15 @@ testCompareXMLToArgvCreateArgs(virQEMUDriver *drv,
|
|||||||
struct testValidateSchemaCommandData {
|
struct testValidateSchemaCommandData {
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *schema;
|
const char *schema;
|
||||||
|
bool allowIncomplete; /* relax validator for commands with incomplete schema */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static const struct testValidateSchemaCommandData commands[] = {
|
static const struct testValidateSchemaCommandData commands[] = {
|
||||||
{ "-blockdev", "blockdev-add" },
|
{ "-blockdev", "blockdev-add", false },
|
||||||
{ "-netdev", "netdev_add" },
|
{ "-netdev", "netdev_add", false },
|
||||||
{ "-object", "object-add" },
|
{ "-object", "object-add", false },
|
||||||
|
{ "-device", "device_add", true },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -535,7 +537,9 @@ testCompareXMLToArgvValidateSchemaCommand(GStrv args,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (testQEMUSchemaValidateCommand(command->schema, jsonargs,
|
if (testQEMUSchemaValidateCommand(command->schema, jsonargs,
|
||||||
schema, false, false, false, &debug) < 0) {
|
schema, false, false,
|
||||||
|
command->allowIncomplete,
|
||||||
|
&debug) < 0) {
|
||||||
VIR_TEST_VERBOSE("failed to validate '%s %s' against QAPI schema: %s",
|
VIR_TEST_VERBOSE("failed to validate '%s %s' against QAPI schema: %s",
|
||||||
command->name, curargs, virBufferCurrentContent(&debug));
|
command->name, curargs, virBufferCurrentContent(&debug));
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user