On a Wednesday in 2020, Peter Krempa wrote:
The new helper splits out all steps necessary to validate a QMP
command
against the schema.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
tests/testutilsqemuschema.c | 44 +++++++++++++++++++++++++++++++++++++
tests/testutilsqemuschema.h | 6 +++++
2 files changed, 50 insertions(+)
diff --git a/tests/testutilsqemuschema.c b/tests/testutilsqemuschema.c
index 7b82ff27b2..60409a0f91 100644
--- a/tests/testutilsqemuschema.c
+++ b/tests/testutilsqemuschema.c
@@ -517,6 +517,50 @@ testQEMUSchemaValidate(virJSONValuePtr obj,
}
+/**
+ * testQEMUSchemaValidateCommand:
+ * @command: command to validate
+ * @arguments: arguments of @command to validate
+ * @schema: hash table containing schema entries
+ * @debug: a virBuffer which will be filled with debug information if provided
+ *
+ * Validates whether @command and it's @arguments conforms to the QAPI schema
*its
*conform
+ * passed in via @schema. Returns 0, if the command and args matches
@schema,
*match
+ * -1 if it does not and -2 if there is a problem with the schema or
with
+ * internals.
+ *
+ * @debug is filled with information regarding the validation process
+ */
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano