[PATCH 010/103] testCompareXMLToArgvValidateSchema: Base -netdev validation on JSON

Peter Krempa posted 103 patches 4 years, 4 months ago
Only 102 patches received!
[PATCH 010/103] testCompareXMLToArgvValidateSchema: Base -netdev validation on JSON
Posted by Peter Krempa 4 years, 4 months ago
Base the validation on presence of JSON as we do with other validated
commands. This will prepare the code for a refactor so that it's the
same for all validated commands.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 tests/qemuxml2argvtest.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 7df3946751..2190e03d18 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -503,7 +503,6 @@ testCompareXMLToArgvValidateSchema(virQEMUDriver *drv,
     GHashTable *schema = NULL;
     g_autoptr(virCommand) cmd = NULL;
     unsigned int parseFlags = info->parseFlags;
-    bool netdevQAPIfied = false;

     /* comment out with line comment to enable schema checking for non _CAPS tests
     if (!info->schemafile)
@@ -546,8 +545,6 @@ testCompareXMLToArgvValidateSchema(virQEMUDriver *drv,
     if (virCommandGetArgList(cmd, &args, &nargs) < 0)
         return -1;

-    netdevQAPIfied = !virQEMUQAPISchemaPathExists("netdev_add/arg-type/type/!string", schema);
-
     for (i = 0; i < nargs; i++) {
         g_auto(virBuffer) debug = VIR_BUFFER_INITIALIZER;
         g_autoptr(virJSONValue) jsonargs = NULL;
@@ -565,7 +562,7 @@ testCompareXMLToArgvValidateSchema(virQEMUDriver *drv,

             i++;
         } else if (STREQ(args[i], "-netdev")) {
-            if (!netdevQAPIfied) {
+            if (*args[i + 1] != '{') {
                 i++;
                 continue;
             }
-- 
2.31.1

Re: [PATCH 010/103] testCompareXMLToArgvValidateSchema: Base -netdev validation on JSON
Posted by Ján Tomko 4 years, 4 months ago
On a Thursday in 2021, Peter Krempa wrote:
>Base the validation on presence of JSON as we do with other validated
>commands. This will prepare the code for a refactor so that it's the
>same for all validated commands.
>
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> tests/qemuxml2argvtest.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano