[01/12] tests: qemuxml2xml: Break out testInfoSet*Paths

Message ID 8cc14a94c53a1cf2a82231817680bb47f57cbc26.1554137098.git.crobinso@redhat.com
State Accepted
Commit 05388311b6e6cf5079c50b382c3d7a0f80ed455c
Headers show
Series
  • tests: qemuxml2xml: add DO_TEST_CAPS*
Related show

Commit Message

Cole Robinson April 1, 2019, 4:47 p.m.
These will need to be separate to share testInfo with qemuxml2argv

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

---
 tests/qemuxml2xmltest.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 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, 3:35 p.m. | #1
On Mon, 2019-04-01 at 12:47 -0400, Cole Robinson wrote:
> These will need to be separate to share testInfo with qemuxml2argv

> 

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

> ---

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

>  1 file changed, 9 insertions(+), 16 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/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 83a0d1cf7b..2dfa9e628b 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -129,16 +129,11 @@  testInfoSetCommon(struct testInfo *info,
     return -1;
 }
 
-
 static int
-testInfoSet(struct testInfo *info,
-            const char *name,
-            int when,
-            int gic)
+testInfoSetPaths(struct testInfo *info,
+                 const char *name,
+                 int when)
 {
-    if (testInfoSetCommon(info, gic) < 0)
-        return -1;
-
     if (virAsprintf(&info->inName, "%s/qemuxml2argvdata/%s.xml",
                     abs_srcdir, name) < 0)
         goto error;
@@ -186,13 +181,9 @@  testInfoSet(struct testInfo *info,
 static const char *statusPath = abs_srcdir "/qemustatusxml2xmldata/";
 
 static int
-testInfoSetStatus(struct testInfo *info,
-                  const char *name,
-                  int gic)
+testInfoSetStatusPaths(struct testInfo *info,
+                       const char *name)
 {
-    if (testInfoSetCommon(info, gic) < 0)
-        return -1;
-
     if (virAsprintf(&info->inName, "%s%s-in.xml", statusPath, name) < 0 ||
         virAsprintf(&info->outActiveName, "%s%s-out.xml", statusPath, name) < 0)
         goto error;
@@ -236,7 +227,8 @@  mymain(void)
 
 # define DO_TEST_FULL(name, when, gic, ...) \
     do { \
-        if (testInfoSet(&info, name, when, gic) < 0) { \
+        if (testInfoSetCommon(&info, gic) < 0 || \
+            testInfoSetPaths(&info, name, when) < 0) { \
             VIR_TEST_DEBUG("Failed to generate test data for '%s'", name); \
             return -1; \
         } \
@@ -1241,7 +1233,8 @@  mymain(void)
 
 # define DO_TEST_STATUS(name) \
     do { \
-        if (testInfoSetStatus(&info, name, GIC_NONE) < 0) { \
+        if (testInfoSetCommon(&info, GIC_NONE) < 0 || \
+            testInfoSetStatusPaths(&info, name) < 0) { \
             VIR_TEST_DEBUG("Failed to generate status test data for '%s'", name); \
             return -1; \
         } \