[02/21] tests: qemuxml2argv: add testInfoSetArgs

Message ID 17389ec524a5d1e5950fa2ae423f106c47508ed4.1552574299.git.crobinso@redhat.com
State New
Headers show
Series
  • tests: qemuxml2argv: support optional arguments
Related show

Commit Message

Cole Robinson March 14, 2019, 2:43 p.m.
For now it just fills in the qemuCaps list. We will expand it
in future patches

Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 tests/qemuxml2argvtest.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

-- 
2.20.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Comments

Andrea Bolognani March 19, 2019, 9:58 a.m. | #1
On Thu, 2019-03-14 at 10:43 -0400, Cole Robinson wrote:
[...]
> +static int

> +testInfoSetArgs(struct testInfo *info, ...)

> +{

> +    va_list argptr;

> +    int ret = 0;

> +

> +    va_start(argptr, info);

> +    virQEMUCapsSetVList(info->qemuCaps, argptr);

> +    va_end(argptr);


Please leave an extra empty line here.

> +    return ret;

> +}


Reviewed-by: Andrea Bolognani <abologna@redhat.com>


-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Patch

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 67c5c74ec5..3b90cd1873 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -624,6 +624,18 @@  testCompareXMLToArgv(const void *data)
     return ret;
 }
 
+static int
+testInfoSetArgs(struct testInfo *info, ...)
+{
+    va_list argptr;
+    int ret = 0;
+
+    va_start(argptr, info);
+    virQEMUCapsSetVList(info->qemuCaps, argptr);
+    va_end(argptr);
+    return ret;
+}
+
 # define FAKEROOTDIRTEMPLATE abs_builddir "/fakerootdir-XXXXXX"
 
 static int
@@ -809,7 +821,8 @@  mymain(void)
         }; \
         if (testInitQEMUCaps(&info, gic) < 0) \
             return EXIT_FAILURE; \
-        virQEMUCapsSetList(info.qemuCaps, __VA_ARGS__, QEMU_CAPS_LAST); \
+        if (testInfoSetArgs(&info, __VA_ARGS__, QEMU_CAPS_LAST) < 0) \
+            return EXIT_FAILURE; \
         if (virTestRun("QEMU XML-2-ARGV " name, \
                        testCompareXMLToArgv, &info) < 0) \
             ret = -1; \