diff mbox series

[09/12] tests: qemuxml2xml: Use struct testQemuInfo

Message ID 277ec917f362a5185bb1603ff98aed3e9f54a138.1554137098.git.crobinso@redhat.com
State Accepted
Commit 0bae87d6741914dfc9fbe5ea1daa59b4b0e8b843
Headers show
Series tests: qemuxml2xml: add DO_TEST_CAPS* | expand

Commit Message

Cole Robinson April 1, 2019, 4:47 p.m. UTC
The qemuxml2xml testInfo is now just a subset of testQemuInfo, so it's
a drop in replacement

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

---
 tests/qemuxml2xmltest.c | 41 ++++++++++++-----------------------------
 1 file changed, 12 insertions(+), 29 deletions(-)

-- 
2.21.0

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

Comments

Andrea Bolognani April 10, 2019, 4:41 p.m. UTC | #1
On Mon, 2019-04-01 at 12:47 -0400, Cole Robinson wrote:
> The qemuxml2xml testInfo is now just a subset of testQemuInfo, so it's

> a drop in replacement

> 

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

> ---

>  tests/qemuxml2xmltest.c | 41 ++++++++++++-----------------------------

>  1 file changed, 12 insertions(+), 29 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
diff mbox series

Patch

diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 538ccae8fd..ba622a3d2f 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -25,18 +25,11 @@  enum {
     WHEN_BOTH = 3,
 };
 
-struct testInfo {
-    char *infile;
-    char *outfile;
-
-    virQEMUCapsPtr qemuCaps;
-};
-
 
 static int
 testXML2XMLActive(const void *opaque)
 {
-    const struct testInfo *info = opaque;
+    const struct testQemuInfo *info = opaque;
 
     return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,
                                       info->infile, info->outfile, true, 0,
@@ -47,7 +40,7 @@  testXML2XMLActive(const void *opaque)
 static int
 testXML2XMLInactive(const void *opaque)
 {
-    const struct testInfo *info = opaque;
+    const struct testQemuInfo *info = opaque;
 
     return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,
                                       info->infile, info->outfile, false, 0,
@@ -58,7 +51,7 @@  testXML2XMLInactive(const void *opaque)
 static int
 testCompareStatusXMLToXMLFiles(const void *opaque)
 {
-    const struct testInfo *data = opaque;
+    const struct testQemuInfo *data = opaque;
     virDomainObjPtr obj = NULL;
     char *actual = NULL;
     int ret = -1;
@@ -95,18 +88,8 @@  testCompareStatusXMLToXMLFiles(const void *opaque)
 }
 
 
-static void
-testInfoClear(struct testInfo *info)
-{
-    VIR_FREE(info->infile);
-    VIR_FREE(info->outfile);
-
-    virObjectUnref(info->qemuCaps);
-}
-
-
 static int
-testInfoSetCommon(struct testInfo *info,
+testInfoSetCommon(struct testQemuInfo *info,
                   int gic)
 {
     if (!(info->qemuCaps = virQEMUCapsNew()))
@@ -121,12 +104,12 @@  testInfoSetCommon(struct testInfo *info,
     return 0;
 
  error:
-    testInfoClear(info);
+    testQemuInfoClear(info);
     return -1;
 }
 
 static int
-testInfoSetPaths(struct testInfo *info,
+testInfoSetPaths(struct testQemuInfo *info,
                  const char *name,
                  int when)
 {
@@ -155,7 +138,7 @@  testInfoSetPaths(struct testInfo *info,
     return 0;
 
  error:
-    testInfoClear(info);
+    testQemuInfoClear(info);
     return -1;
 }
 
@@ -163,7 +146,7 @@  testInfoSetPaths(struct testInfo *info,
 static const char *statusPath = abs_srcdir "/qemustatusxml2xmldata/";
 
 static int
-testInfoSetStatusPaths(struct testInfo *info,
+testInfoSetStatusPaths(struct testQemuInfo *info,
                        const char *name)
 {
     if (virAsprintf(&info->infile, "%s%s-in.xml", statusPath, name) < 0 ||
@@ -173,7 +156,7 @@  testInfoSetStatusPaths(struct testInfo *info,
     return 0;
 
  error:
-    testInfoClear(info);
+    testQemuInfoClear(info);
     return -1;
 }
 
@@ -185,7 +168,7 @@  mymain(void)
 {
     int ret = 0;
     char *fakerootdir;
-    struct testInfo info;
+    struct testQemuInfo info;
     virQEMUDriverConfigPtr cfg = NULL;
 
     if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) {
@@ -234,7 +217,7 @@  mymain(void)
                             testXML2XMLActive, &info) < 0) \
                 ret = -1; \
         } \
-        testInfoClear(&info); \
+        testQemuInfoClear(&info); \
     } while (0)
 
 # define NONE QEMU_CAPS_LAST
@@ -1232,7 +1215,7 @@  mymain(void)
                        testCompareStatusXMLToXMLFiles, &info) < 0) \
             ret = -1; \
 \
-        testInfoClear(&info); \
+        testQemuInfoClear(&info); \
     } while (0)