[05/21] tests: qemuxml2argv: break apart testInitQEMUCaps

Message ID 4d2f36a09568251a2b9b81f28995cd2575b3cc6f.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.
Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 tests/qemuxml2argvtest.c | 23 +++--------------------
 1 file changed, 3 insertions(+), 20 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, 12:57 p.m. | #1
On Thu, 2019-03-14 at 10:43 -0400, Cole Robinson wrote:
> Signed-off-by: Cole Robinson <crobinso@redhat.com>

> ---

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

>  1 file changed, 3 insertions(+), 20 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 393d2399fa..06a28178d0 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -378,25 +378,6 @@  testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy)
 }
 
 
-static int
-testInitQEMUCaps(struct testInfo *info,
-                 int gic)
-{
-    int ret = -1;
-
-    if (!(info->qemuCaps = virQEMUCapsNew()))
-        goto cleanup;
-
-    if (testQemuCapsSetGIC(info->qemuCaps, gic) < 0)
-        goto cleanup;
-
-    ret = 0;
-
- cleanup:
-    return ret;
-}
-
-
 static int
 testUpdateQEMUCaps(const struct testInfo *info,
                    virDomainObjPtr vm,
@@ -840,7 +821,9 @@  mymain(void)
         static struct testInfo info = { \
             name, NULL, NULL, migrateFrom, migrateFd, (flags), parseFlags, \
         }; \
-        if (testInitQEMUCaps(&info, gic) < 0) \
+        if (!(info.qemuCaps = virQEMUCapsNew())) \
+            return EXIT_FAILURE; \
+        if (testQemuCapsSetGIC(info.qemuCaps, gic) < 0) \
             return EXIT_FAILURE; \
         if (testInfoSetArgs(&info, __VA_ARGS__, QEMU_CAPS_LAST, ARG_END) < 0) \
             return EXIT_FAILURE; \