]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
testCompareXMLToArgvValidateSchemaCommand: Add validation for '-device'
authorPeter Krempa <pkrempa@redhat.com>
Fri, 15 Oct 2021 10:21:06 +0000 (12:21 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 18 Oct 2021 12:00:59 +0000 (14:00 +0200)
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>
tests/qemuxml2argvtest.c

index d6cc2a51c28434aec413e938b74824c9b151d6d3..e209b48fce6533efd97e73ca388e4ebb6903df1a 100644 (file)
@@ -490,13 +490,15 @@ testCompareXMLToArgvCreateArgs(virQEMUDriver *drv,
 struct testValidateSchemaCommandData {
     const char *name;
     const char *schema;
+    bool allowIncomplete; /* relax validator for commands with incomplete schema */
 };
 
 
 static const struct testValidateSchemaCommandData commands[] = {
-    { "-blockdev", "blockdev-add" },
-    { "-netdev", "netdev_add" },
-    { "-object", "object-add" },
+    { "-blockdev", "blockdev-add", false },
+    { "-netdev", "netdev_add", false },
+    { "-object", "object-add", false },
+    { "-device", "device_add", true },
 };
 
 static int
@@ -535,7 +537,9 @@ testCompareXMLToArgvValidateSchemaCommand(GStrv args,
                 return -1;
 
             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",
                                  command->name, curargs, virBufferCurrentContent(&debug));
                 return -1;