[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 1/4] Use separate macros for failure/success in vol-to-argv test



Reindent them to put the input volume on a separate line.
---
 tests/storagevolxml2argvtest.c | 64 +++++++++++++++++++++++++++++-------------
 1 file changed, 44 insertions(+), 20 deletions(-)

diff --git a/tests/storagevolxml2argvtest.c b/tests/storagevolxml2argvtest.c
index 89c233f..4f4bf7d 100644
--- a/tests/storagevolxml2argvtest.c
+++ b/tests/storagevolxml2argvtest.c
@@ -161,7 +161,8 @@ mymain(void)
     int ret = 0;
     unsigned int flags = VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA;
 
-#define DO_TEST(shouldFail, pool, vol, inputvol, cmdline, flags, imgformat) \
+#define DO_TEST_FULL(shouldFail, pool, vol, inputvol, cmdline, flags, \
+                     imgformat) \
     do {                    \
         struct testInfo info = { shouldFail, pool, vol, inputvol, cmdline, \
                                  flags, imgformat }; \
@@ -171,31 +172,54 @@ mymain(void)
        }    \
     while (0);
 
-    DO_TEST(false, "pool-dir", "vol-qcow2", NULL, "qcow2", 0, FMT_OPTIONS);
-    DO_TEST(true, "pool-dir", "vol-qcow2", NULL, "qcow2-prealloc", flags,
-            FMT_OPTIONS);
-    DO_TEST(false, "pool-dir", "vol-qcow2-nobacking", NULL,
+#define DO_TEST(pool, ...)                                                 \
+    DO_TEST_FULL(false, pool, __VA_ARGS__)
+
+#define DO_TEST_FAIL(pool, ...)                                            \
+    DO_TEST_FULL(true, pool, __VA_ARGS__)
+
+    DO_TEST("pool-dir", "vol-qcow2",
+            NULL,
+            "qcow2", 0, FMT_OPTIONS);
+    DO_TEST_FAIL("pool-dir", "vol-qcow2",
+                 NULL,
+                 "qcow2-prealloc", flags, FMT_OPTIONS);
+    DO_TEST("pool-dir", "vol-qcow2-nobacking",
+            NULL,
             "qcow2-nobacking-prealloc", flags, FMT_OPTIONS);
-    DO_TEST(false, "pool-dir", "vol-qcow2-nobacking", "vol-file",
+    DO_TEST("pool-dir", "vol-qcow2-nobacking",
+            "vol-file",
             "qcow2-nobacking-convert-prealloc", flags, FMT_OPTIONS);
-    DO_TEST(true, "pool-dir", "vol-qcow2", "vol-file",
-            "qcow2-convert-prealloc", flags, FMT_OPTIONS);
-    DO_TEST(false, "pool-dir", "vol-qcow2", NULL, "qcow2-flag", 0, FMT_FLAG);
-    DO_TEST(false, "pool-dir", "vol-qcow2-nobacking", NULL,
+    DO_TEST_FAIL("pool-dir", "vol-qcow2",
+                 "vol-file",
+                 "qcow2-convert-prealloc", flags, FMT_OPTIONS);
+    DO_TEST("pool-dir", "vol-qcow2",
+            NULL,
+            "qcow2-flag", 0, FMT_FLAG);
+    DO_TEST("pool-dir", "vol-qcow2-nobacking",
+            NULL,
             "qcow2-nobacking-flag", 0, FMT_FLAG);
-    DO_TEST(false, "pool-dir", "vol-qcow2-nobacking", "vol-file",
+    DO_TEST("pool-dir", "vol-qcow2-nobacking",
+            "vol-file",
             "qcow2-nobacking-convert-flag", 0, FMT_FLAG);
-    DO_TEST(false, "pool-dir", "vol-qcow2", NULL, "qcow2-none", 0, FMT_NONE);
-    DO_TEST(false, "pool-dir", "vol-qcow2-nobacking", NULL,
+    DO_TEST("pool-dir", "vol-qcow2",
+            NULL,
+            "qcow2-none", 0, FMT_NONE);
+    DO_TEST("pool-dir", "vol-qcow2-nobacking",
+            NULL,
             "qcow2-nobacking-none", 0, FMT_NONE);
-    DO_TEST(false, "pool-dir", "vol-qcow2-nobacking", "vol-file",
+    DO_TEST("pool-dir", "vol-qcow2-nobacking",
+            "vol-file",
             "qcow2-nobacking-convert-none", 0, FMT_NONE);
-    DO_TEST(false, "pool-dir", "vol-qcow2-lazy", NULL, "qcow2-lazy", 0,
-            FMT_OPTIONS);
-    DO_TEST(false, "pool-dir", "vol-qcow2-1.1", NULL, "qcow2-1.1", 0,
-            FMT_OPTIONS);
-    DO_TEST(true, "pool-dir", "vol-qcow2-0.10-lazy", NULL, "qcow2-0.10-lazy", 0,
-            FMT_OPTIONS);
+    DO_TEST("pool-dir", "vol-qcow2-lazy",
+            NULL,
+            "qcow2-lazy", 0, FMT_OPTIONS);
+    DO_TEST("pool-dir", "vol-qcow2-1.1",
+            NULL,
+            "qcow2-1.1", 0, FMT_OPTIONS);
+    DO_TEST_FAIL("pool-dir", "vol-qcow2-0.10-lazy",
+                 NULL,
+                 "qcow2-0.10-lazy", 0, FMT_OPTIONS);
 
     return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
-- 
1.8.1.5


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]