[18/21] tests: qemuxml2argv: add testInfoClear

Message ID 7ce3cbe2cb0f11241884f5ca15f4f84d0585ce2f.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:44 p.m.
This is closer to the pattern of qemuxml2xml tests, and will make
things easier if we extend testInfo to contain more freeable data

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

---
 tests/qemuxml2argvtest.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

-- 
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, 2:28 p.m. | #1
On Thu, 2019-03-14 at 10:44 -0400, Cole Robinson wrote:
> This is closer to the pattern of qemuxml2xml tests, and will make

> things easier if we extend testInfo to contain more freeable data

> 

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

> ---

>  tests/qemuxml2argvtest.c | 11 ++++++++---

>  1 file changed, 8 insertions(+), 3 deletions(-)


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 496e33f4e5..813871d6b8 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -665,6 +665,12 @@  testInfoSetArgs(struct testInfo *info, ...)
     return ret;
 }
 
+static void
+testInfoClear(struct testInfo *info)
+{
+    virObjectUnref(info->qemuCaps);
+}
+
 # define FAKEROOTDIRTEMPLATE abs_builddir "/fakerootdir-XXXXXX"
 
 static int
@@ -811,10 +817,9 @@  mymain(void)
         if (virTestRun("QEMU XML-2-ARGV " _name "." arch "-" ver, \
                        testCompareXMLToArgv, &info) < 0) \
             ret = -1; \
-        virObjectUnref(info.qemuCaps); \
+        testInfoClear(&info); \
     } while (0)
 
-
 # define DO_TEST_CAPS_ARCH_VER(name, arch, ver) \
     DO_TEST_CAPS_INTERNAL(name, arch, ver, ARG_END)
 
@@ -853,7 +858,7 @@  mymain(void)
         if (virTestRun("QEMU XML-2-ARGV " _name, \
                        testCompareXMLToArgv, &info) < 0) \
             ret = -1; \
-        virObjectUnref(info.qemuCaps); \
+        testInfoClear(&info); \
     } while (0)
 
 # define DO_TEST(name, ...) \