diff mbox series

[v2,4/4] tests: qemuxml2argv: add DO_TEST_INTERNAL

Message ID f59c61d9232a331e57b6a9ef3564e9213fa669cf.1553197802.git.crobinso@redhat.com
State Accepted
Commit 530c1671e120c4415bfc20c318199738f2ae795c
Headers show
Series tests: qemuxml2argv: support optional arguments | expand

Commit Message

Cole Robinson March 21, 2019, 7:55 p.m. UTC
Base macro to unify the actual testCompareXMLToArgv test calls

Reviewed-by: Andrea Bolognani <abologna@redhat.com>

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

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

-- 
2.21.0

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

Comments

Andrea Bolognani March 22, 2019, 9:22 a.m. UTC | #1
On Thu, 2019-03-21 at 15:55 -0400, Cole Robinson wrote:
[...]
> +# define DO_TEST_FULL(name, ...) \

> +    DO_TEST_INTERNAL(name, "", __VA_ARGS__, QEMU_CAPS_LAST)


I'd put the last two arguments on a separate line.


Either way,

  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/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 34394181c1..4b05b4e846 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -866,23 +866,27 @@  mymain(void)
  * the test cases should be forked using DO_TEST_CAPS_VER with the appropriate
  * version.
  */
-# define DO_TEST_CAPS_INTERNAL(_name, arch, ver, ...) \
+# define DO_TEST_INTERNAL(_name, _suffix, ...) \
     do { \
         static struct testInfo info = { \
             .name = _name, \
-            .suffix = "." arch "-" ver, \
+            .suffix = _suffix, \
         }; \
         if (testInfoSetArgs(&info, capslatest, \
-                            ARG_CAPS_ARCH, arch, \
-                            ARG_CAPS_VER, ver, \
                             __VA_ARGS__, ARG_END) < 0) \
             return EXIT_FAILURE; \
-        if (virTestRun("QEMU XML-2-ARGV " _name "." arch "-" ver, \
+        if (virTestRun("QEMU XML-2-ARGV " _name _suffix, \
                        testCompareXMLToArgv, &info) < 0) \
             ret = -1; \
         testInfoClear(&info); \
     } while (0)
 
+# define DO_TEST_CAPS_INTERNAL(name, arch, ver, ...) \
+    DO_TEST_INTERNAL(name, "." arch "-" ver, \
+                     ARG_CAPS_ARCH, arch, \
+                     ARG_CAPS_VER, ver, \
+                     __VA_ARGS__)
+
 # define DO_TEST_CAPS_ARCH_VER(name, arch, ver) \
     DO_TEST_CAPS_INTERNAL(name, arch, ver, ARG_END)
 
@@ -907,19 +911,8 @@  mymain(void)
                                   ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR)
 
 
-# define DO_TEST_FULL(_name, ...) \
-    do { \
-        static struct testInfo info = { \
-            .name = _name, \
-        }; \
-        if (testInfoSetArgs(&info, capslatest, \
-                            __VA_ARGS__, QEMU_CAPS_LAST, ARG_END) < 0) \
-            return EXIT_FAILURE; \
-        if (virTestRun("QEMU XML-2-ARGV " _name, \
-                       testCompareXMLToArgv, &info) < 0) \
-            ret = -1; \
-        testInfoClear(&info); \
-    } while (0)
+# define DO_TEST_FULL(name, ...) \
+    DO_TEST_INTERNAL(name, "", __VA_ARGS__, QEMU_CAPS_LAST)
 
 /* All the following macros require an explicit QEMU_CAPS_* list
  * at the end of the argument list, or the NONE placeholder.