]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: qemuxml2argv: Validate generation of JSON props for object-add
authorPeter Krempa <pkrempa@redhat.com>
Thu, 26 Nov 2020 17:35:55 +0000 (18:35 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 23 Mar 2021 13:06:31 +0000 (14:06 +0100)
Similarly to the validation for blockdev-add and netdev_add, use the
qemuxml2argv test repository to drive validation of props for
object-add.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tests/qemuxml2argvtest.c

index 44c2a316b07b716958613d86b2a261189e5d3f4e..1f53d95f13c6207aba221ea4c5b9e39ecf881740 100644 (file)
@@ -603,6 +603,24 @@ testCompareXMLToArgvValidateSchema(virQEMUDriverPtr drv,
                 return -1;
             }
 
+            i++;
+        } else if (STREQ(args[i], "-object")) {
+
+            if (*args[i + 1] != '{') {
+                i++;
+                continue;
+            }
+
+            if (!(jsonargs = virJSONValueFromString(args[i + 1])))
+                return -1;
+
+            if (testQEMUSchemaValidateCommand("object-add", jsonargs,
+                                              schema, false, false, &debug) < 0) {
+                VIR_TEST_VERBOSE("failed to validate -object '%s' against QAPI schema: %s",
+                                 args[i + 1], virBufferCurrentContent(&debug));
+                return -1;
+            }
+
             i++;
         }
     }