[07/21] tests: qemuxml2argv: handle migrate* with varargs

Message ID 4ba5569ff35e3d3019b26120ea76f869d4502689.1552574299.git.crobinso@redhat.com
State Accepted
Commit 0ecf885be1d2366de8d5f54bc4362075b38cc61e
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 migrateFrom and migrateFd from DO_TEST_FULL

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

---
 tests/qemuxml2argvtest.c | 46 ++++++++++++++++++++++++++--------------
 1 file changed, 30 insertions(+), 16 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:08 p.m. | #1
On Thu, 2019-03-14 at 10:44 -0400, Cole Robinson wrote:
[...]
> -    DO_TEST_FULL("restore-v2", "exec:cat", 7, 0, 0,

> +    DO_TEST_FULL("restore-v2", 0, 0,

> +                 ARG_MIGRATE_FROM, "exec:cat", ARG_MIGRATE_FD, 7,

>                   ARG_QEMU_CAPS, NONE);

> -    DO_TEST_FULL("restore-v2-fd", "stdio", 7, 0, 0,

> +    DO_TEST_FULL("restore-v2-fd", 0, 0,

> +                 ARG_MIGRATE_FROM, "stdio", ARG_MIGRATE_FD, 7,

>                   ARG_QEMU_CAPS, NONE);

> -    DO_TEST_FULL("restore-v2-fd", "fd:7", 7, 0, 0,

> +    DO_TEST_FULL("restore-v2-fd", 0, 0,

> +                 ARG_MIGRATE_FROM, "fd:7", ARG_MIGRATE_FD, 7,

>                   ARG_QEMU_CAPS, NONE);


I'd put ARG_MIGRATE_FROM and ARG_MIGRATE_FD on separate lines here.

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
Andrea Bolognani March 19, 2019, 1:10 p.m. | #2
On Thu, 2019-03-14 at 10:44 -0400, Cole Robinson wrote:
> This allows us to drop migrateFrom and migrateFd from DO_TEST_FULL

> 

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

> ---

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

>  1 file changed, 30 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
Andrea Bolognani March 19, 2019, 1:11 p.m. | #3
On Tue, 2019-03-19 at 14:10 +0100, Andrea Bolognani wrote:
> On Thu, 2019-03-14 at 10:44 -0400, Cole Robinson wrote:

> > This allows us to drop migrateFrom and migrateFd from DO_TEST_FULL

> > 

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

> > ---

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

> >  1 file changed, 30 insertions(+), 16 deletions(-)

> 

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


Disregard this message - I replied to the wrong patch by mistake.

-- 
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 60df2c3a00..c6bd240c54 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -608,6 +608,8 @@  testCompareXMLToArgv(const void *data)
 typedef enum {
     ARG_QEMU_CAPS = 1,
     ARG_GIC,
+    ARG_MIGRATE_FROM,
+    ARG_MIGRATE_FD,
 
     ARG_END = QEMU_CAPS_LAST,
 } testInfoArgNames;
@@ -632,6 +634,14 @@  testInfoSetArgs(struct testInfo *info, ...)
                 goto cleanup;
             break;
 
+        case ARG_MIGRATE_FROM:
+            info->migrateFrom = va_arg(argptr, char *);
+            break;
+
+        case ARG_MIGRATE_FD:
+            info->migrateFd = va_arg(argptr, int);
+            break;
+
         case ARG_END:
         default:
             fprintf(stderr, "Unexpected test info argument");
@@ -822,11 +832,10 @@  mymain(void)
 # define DO_TEST_CAPS(name, ver) \
     DO_TEST_CAPS_FULL(name, 0, 0, ver)
 
-# define DO_TEST_FULL(name, migrateFrom, migrateFd, flags, \
-                      parseFlags, ...) \
+# define DO_TEST_FULL(name, flags, parseFlags, ...) \
     do { \
         static struct testInfo info = { \
-            name, NULL, NULL, migrateFrom, migrateFd, (flags), parseFlags, \
+            name, NULL, NULL, NULL, -1, (flags), parseFlags, \
         }; \
         if (!(info.qemuCaps = virQEMUCapsNew())) \
             return EXIT_FAILURE; \
@@ -839,27 +848,27 @@  mymain(void)
     } while (0)
 
 # define DO_TEST(name, ...) \
-    DO_TEST_FULL(name, NULL, -1, 0, 0, \
+    DO_TEST_FULL(name, 0, 0, \
                  ARG_QEMU_CAPS, __VA_ARGS__)
 
 # define DO_TEST_GIC(name, gic, ...) \
-    DO_TEST_FULL(name, NULL, -1, 0, 0, \
+    DO_TEST_FULL(name, 0, 0, \
                  ARG_GIC, gic, \
                  ARG_QEMU_CAPS, __VA_ARGS__)
 
 # define DO_TEST_FAILURE(name, ...) \
-    DO_TEST_FULL(name, NULL, -1, FLAG_EXPECT_FAILURE, \
+    DO_TEST_FULL(name, FLAG_EXPECT_FAILURE, \
                  0, \
                  ARG_QEMU_CAPS, __VA_ARGS__)
 
 # define DO_TEST_PARSE_ERROR(name, ...) \
-    DO_TEST_FULL(name, NULL, -1, \
+    DO_TEST_FULL(name, \
                  FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE, \
                  0, \
                  ARG_QEMU_CAPS, __VA_ARGS__)
 
 # define DO_TEST_PARSE_FLAGS_ERROR(name, parseFlags, ...) \
-    DO_TEST_FULL(name, NULL, -1, \
+    DO_TEST_FULL(name, \
                  FLAG_EXPECT_PARSE_ERROR | FLAG_EXPECT_FAILURE, \
                  parseFlags, \
                  ARG_QEMU_CAPS, __VA_ARGS__)
@@ -1700,16 +1709,21 @@  mymain(void)
             QEMU_CAPS_CCW_CSSID_UNRESTRICTED,
             QEMU_CAPS_DEVICE_VFIO_CCW);
 
-    DO_TEST_FULL("restore-v2", "exec:cat", 7, 0, 0,
+    DO_TEST_FULL("restore-v2", 0, 0,
+                 ARG_MIGRATE_FROM, "exec:cat", ARG_MIGRATE_FD, 7,
                  ARG_QEMU_CAPS, NONE);
-    DO_TEST_FULL("restore-v2-fd", "stdio", 7, 0, 0,
+    DO_TEST_FULL("restore-v2-fd", 0, 0,
+                 ARG_MIGRATE_FROM, "stdio", ARG_MIGRATE_FD, 7,
                  ARG_QEMU_CAPS, NONE);
-    DO_TEST_FULL("restore-v2-fd", "fd:7", 7, 0, 0,
+    DO_TEST_FULL("restore-v2-fd", 0, 0,
+                 ARG_MIGRATE_FROM, "fd:7", ARG_MIGRATE_FD, 7,
                  ARG_QEMU_CAPS, NONE);
-    DO_TEST_FULL("migrate", "tcp:10.0.0.1:5000", -1, 0, 0,
+    DO_TEST_FULL("migrate", 0, 0,
+                 ARG_MIGRATE_FROM, "tcp:10.0.0.1:5000",
                  ARG_QEMU_CAPS, NONE);
 
-    DO_TEST_FULL("migrate-numa-unaligned", "stdio", 7, 0, 0,
+    DO_TEST_FULL("migrate-numa-unaligned", 0, 0,
+                 ARG_MIGRATE_FROM, "stdio", ARG_MIGRATE_FD, 7,
                  ARG_QEMU_CAPS,
                  QEMU_CAPS_NUMA,
                  QEMU_CAPS_OBJECT_MEMORY_RAM);
@@ -1752,10 +1766,10 @@  mymain(void)
     DO_TEST("cpu-numa-memshared", QEMU_CAPS_OBJECT_MEMORY_FILE);
     DO_TEST("cpu-host-model", NONE);
     DO_TEST("cpu-host-model-vendor", NONE);
-    DO_TEST_FULL("cpu-host-model-fallback", NULL, -1,
+    DO_TEST_FULL("cpu-host-model-fallback",
                  FLAG_SKIP_LEGACY_CPUS, 0,
                  ARG_QEMU_CAPS, NONE);
-    DO_TEST_FULL("cpu-host-model-nofallback", NULL, -1,
+    DO_TEST_FULL("cpu-host-model-nofallback",
                  FLAG_SKIP_LEGACY_CPUS | FLAG_EXPECT_FAILURE,
                  0,
                  ARG_QEMU_CAPS, NONE);
@@ -2846,7 +2860,7 @@  mymain(void)
     DO_TEST("ppc64-usb-controller-legacy",
             QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
             QEMU_CAPS_PIIX3_USB_UHCI);
-    DO_TEST_FULL("ppc64-usb-controller-qemu-xhci", NULL, -1, 0,
+    DO_TEST_FULL("ppc64-usb-controller-qemu-xhci", 0,
                  VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
                  ARG_QEMU_CAPS,
                  QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,