[libvirt] [PATCH 18/21] tests: qemuxml2argv: add testInfoClear

Cole Robinson crobinso at redhat.com
Thu Mar 14 14:44:11 UTC 2019


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 at redhat.com>
---
 tests/qemuxml2argvtest.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

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, ...) \
-- 
2.20.1




More information about the libvir-list mailing list