[09/21] tests: qemuxml2argv: handle parseFlags with varargs

Message ID 22a08c100f4842b3a9b5c862f00f48eea1a9c5f1.1552574299.git.crobinso@redhat.com
State Accepted
Commit 8bffb1fcd546cce1f3e3e60e345bb69546f307b1
Headers show
Series
  • tests: qemuxml2argv: support optional arguments
Related show

Commit Message

Cole Robinson March 14, 2019, 2:44 p.m.
This allows us to drop parseFlags from DO_TEST_FULL

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

---
 tests/qemuxml2argvtest.c | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 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, 1:14 p.m. | #1
On Thu, 2019-03-14 at 10:44 -0400, Cole Robinson wrote:
> This allows us to drop parseFlags from DO_TEST_FULL

> 

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


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 bb3d53070f..070f7f0a05 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -611,6 +611,7 @@  typedef enum {
     ARG_MIGRATE_FROM,
     ARG_MIGRATE_FD,
     ARG_FLAGS,
+    ARG_PARSEFLAGS,
 
     ARG_END = QEMU_CAPS_LAST,
 } testInfoArgNames;
@@ -647,6 +648,10 @@  testInfoSetArgs(struct testInfo *info, ...)
             info->flags = va_arg(argptr, int);
             break;
 
+        case ARG_PARSEFLAGS:
+            info->parseFlags = va_arg(argptr, int);
+            break;
+
         case ARG_END:
         default:
             fprintf(stderr, "Unexpected test info argument");
@@ -837,10 +842,10 @@  mymain(void)
 # define DO_TEST_CAPS(name, ver) \
     DO_TEST_CAPS_FULL(name, 0, 0, ver)
 
-# define DO_TEST_FULL(name, parseFlags, ...) \
+# define DO_TEST_FULL(name, ...) \
     do { \
         static struct testInfo info = { \
-            name, NULL, NULL, NULL, -1, 0, parseFlags, \
+            name, NULL, NULL, NULL, -1, 0, 0, \
         }; \
         if (!(info.qemuCaps = virQEMUCapsNew())) \
             return EXIT_FAILURE; \
@@ -853,29 +858,27 @@  mymain(void)
     } while (0)
 
 # define DO_TEST(name, ...) \
-    DO_TEST_FULL(name, 0, \
+    DO_TEST_FULL(name, \
                  ARG_QEMU_CAPS, __VA_ARGS__)
 
 # define DO_TEST_GIC(name, gic, ...) \
-    DO_TEST_FULL(name, 0, \
+    DO_TEST_FULL(name, \
                  ARG_GIC, gic, \
                  ARG_QEMU_CAPS, __VA_ARGS__)
 
 # define DO_TEST_FAILURE(name, ...) \
     DO_TEST_FULL(name, \
-                 0, \
                  ARG_FLAGS, FLAG_EXPECT_FAILURE, \
                  ARG_QEMU_CAPS, __VA_ARGS__)
 
 # define DO_TEST_PARSE_ERROR(name, ...) \
     DO_TEST_FULL(name, \
-                 0, \
                  ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE, \
                  ARG_QEMU_CAPS, __VA_ARGS__)
 
 # define DO_TEST_PARSE_FLAGS_ERROR(name, parseFlags, ...) \
     DO_TEST_FULL(name, \
-                 parseFlags, \
+                 ARG_PARSEFLAGS, parseFlags, \
                  ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE, \
                  ARG_QEMU_CAPS, __VA_ARGS__)
 
@@ -1715,20 +1718,20 @@  mymain(void)
             QEMU_CAPS_CCW_CSSID_UNRESTRICTED,
             QEMU_CAPS_DEVICE_VFIO_CCW);
 
-    DO_TEST_FULL("restore-v2", 0,
+    DO_TEST_FULL("restore-v2",
                  ARG_MIGRATE_FROM, "exec:cat", ARG_MIGRATE_FD, 7,
                  ARG_QEMU_CAPS, NONE);
-    DO_TEST_FULL("restore-v2-fd", 0,
+    DO_TEST_FULL("restore-v2-fd",
                  ARG_MIGRATE_FROM, "stdio", ARG_MIGRATE_FD, 7,
                  ARG_QEMU_CAPS, NONE);
-    DO_TEST_FULL("restore-v2-fd", 0,
+    DO_TEST_FULL("restore-v2-fd",
                  ARG_MIGRATE_FROM, "fd:7", ARG_MIGRATE_FD, 7,
                  ARG_QEMU_CAPS, NONE);
-    DO_TEST_FULL("migrate", 0,
+    DO_TEST_FULL("migrate",
                  ARG_MIGRATE_FROM, "tcp:10.0.0.1:5000",
                  ARG_QEMU_CAPS, NONE);
 
-    DO_TEST_FULL("migrate-numa-unaligned", 0,
+    DO_TEST_FULL("migrate-numa-unaligned",
                  ARG_MIGRATE_FROM, "stdio", ARG_MIGRATE_FD, 7,
                  ARG_QEMU_CAPS,
                  QEMU_CAPS_NUMA,
@@ -1773,11 +1776,9 @@  mymain(void)
     DO_TEST("cpu-host-model", NONE);
     DO_TEST("cpu-host-model-vendor", NONE);
     DO_TEST_FULL("cpu-host-model-fallback",
-                 0,
                  ARG_FLAGS, FLAG_SKIP_LEGACY_CPUS,
                  ARG_QEMU_CAPS, NONE);
     DO_TEST_FULL("cpu-host-model-nofallback",
-                 0,
                  ARG_FLAGS, FLAG_SKIP_LEGACY_CPUS | FLAG_EXPECT_FAILURE,
                  ARG_QEMU_CAPS, NONE);
     DO_TEST("cpu-host-passthrough", QEMU_CAPS_KVM);
@@ -2868,7 +2869,7 @@  mymain(void)
             QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
             QEMU_CAPS_PIIX3_USB_UHCI);
     DO_TEST_FULL("ppc64-usb-controller-qemu-xhci",
-                 VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
+                 ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
                  ARG_QEMU_CAPS,
                  QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
                  QEMU_CAPS_NEC_USB_XHCI,