diff mbox series

[21/21] tests: qemuxml2argv: add TEST_INTERNAL

Message ID 32ac0ed1c8062c3cf0dc52f1c326d0495ce389c0.1552574299.git.crobinso@redhat.com
State New
Headers show
Series tests: qemuxml2argv: support optional arguments | expand

Commit Message

Cole Robinson March 14, 2019, 2:44 p.m. UTC
Base macro to unify the actual testCompareXMLToArgv test calls

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

---
 tests/qemuxml2argvtest.c | 29 +++++++++++------------------
 1 file changed, 11 insertions(+), 18 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, 3:24 p.m. UTC | #1
On Thu, 2019-03-14 at 10:44 -0400, Cole Robinson wrote:
[...]
> +# define TEST_INTERNAL(_name, _suffix, ...) \


This macro should be called DO_TEST_INTERNAL() - you're still
running the test from it, so the DO_ prefix is fully warranted.

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 d5e02c26d8..a901582ef6 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -842,23 +842,27 @@  mymain(void)
  * version.
  */
 
-# define DO_TEST_CAPS_INTERNAL(_name, arch, ver, ...) \
+# define 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, ...) \
+    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)
 
@@ -885,19 +889,8 @@  mymain(void)
 
 /* All the following macros require an explicit QEMU_CAPS_* list
  * at the end of the argument list, or the NONE placeholder */
-# 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, ...) \
+    TEST_INTERNAL(name, "", __VA_ARGS__, QEMU_CAPS_LAST)
 
 # define DO_TEST(name, ...) \
     DO_TEST_FULL(name, \