[PATCH 10/12] tests: qemuxml2argv: Don't check whether -netdev was QAPIfied repeatedly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Check once before looping through the args.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tests/qemuxml2argvtest.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index d2712e0dce..662d0d5df6 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -524,6 +524,7 @@ testCompareXMLToArgvValidateSchema(virQEMUDriverPtr drv,
     g_autoptr(GHashTable) schema = NULL;
     g_autoptr(virCommand) cmd = NULL;
     unsigned int parseFlags = info->parseFlags;
+    bool netdevQAPIfied = false;

     if (info->schemafile)
         schema = testQEMUSchemaLoad(info->schemafile);
@@ -552,6 +553,8 @@ testCompareXMLToArgvValidateSchema(virQEMUDriverPtr 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;
@@ -569,13 +572,14 @@ testCompareXMLToArgvValidateSchema(virQEMUDriverPtr drv,

             i++;
         } else if (STREQ(args[i], "-netdev")) {
+            if (!netdevQAPIfied) {
+                i++;
+                continue;
+            }
+
             if (!(jsonargs = virJSONValueFromString(args[i + 1])))
                 return -1;

-            /* skip the validation for pre-QAPIfication cases */
-            if (virQEMUQAPISchemaPathExists("netdev_add/arg-type/type/!string", schema))
-                continue;
-
             if (testQEMUSchemaValidateCommand("netdev_add", jsonargs,
                                               schema, false, false, &debug) < 0) {
                 VIR_TEST_VERBOSE("failed to validate -netdev '%s' against QAPI schema: %s",
-- 
2.29.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux