[libvirt PATCH] tests: change confusing macro agument names

Jonathon Jongsma posted 1 patch 3 years, 7 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20200902194538.644086-1-jjongsma@redhat.com
tests/qemuhotplugtest.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
[libvirt PATCH] tests: change confusing macro agument names
Posted by Jonathon Jongsma 3 years, 7 months ago
Rather than use the names "fial" and "kep", use "fail" and "keep". In
the DO_TEST() macro, to prevent the preprocessor replacing the struct
member names during assignment, use the names "fail_" and "keep_"
instead.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
 tests/qemuhotplugtest.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index 1e18820a2b..b023c49a69 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -641,28 +641,28 @@ mymain(void)
     }
 
 
-#define DO_TEST(file, ACTION, dev, fial, kep, ...) \
+#define DO_TEST(file, ACTION, dev, fail_, keep_, ...) \
     do { \
         const char *my_mon[] = { __VA_ARGS__, NULL}; \
         const char *name = file " " #ACTION " " dev; \
         data.action = ACTION; \
         data.domain_filename = file; \
         data.device_filename = dev; \
-        data.fail = fial; \
+        data.fail = fail_; \
         data.mon = my_mon; \
-        data.keep = kep; \
+        data.keep = keep_; \
         if (virTestRun(name, testQemuHotplug, &data) < 0) \
             ret = -1; \
     } while (0)
 
-#define DO_TEST_ATTACH(file, dev, fial, kep, ...) \
-    DO_TEST(file, ATTACH, dev, fial, kep, __VA_ARGS__)
+#define DO_TEST_ATTACH(file, dev, fail, keep, ...) \
+    DO_TEST(file, ATTACH, dev, fail, keep, __VA_ARGS__)
 
-#define DO_TEST_DETACH(file, dev, fial, kep, ...) \
-    DO_TEST(file, DETACH, dev, fial, kep, __VA_ARGS__)
+#define DO_TEST_DETACH(file, dev, fail, keep, ...) \
+    DO_TEST(file, DETACH, dev, fail, keep, __VA_ARGS__)
 
-#define DO_TEST_UPDATE(file, dev, fial, kep, ...) \
-    DO_TEST(file, UPDATE, dev, fial, kep, __VA_ARGS__)
+#define DO_TEST_UPDATE(file, dev, fail, keep, ...) \
+    DO_TEST(file, UPDATE, dev, fail, keep, __VA_ARGS__)
 
 
 #define QMP_OK      "{\"return\": {}}"
-- 
2.26.2

Re: [libvirt PATCH] tests: change confusing macro agument names
Posted by Laine Stump 3 years, 7 months ago
On 9/2/20 3:45 PM, Jonathon Jongsma wrote:
> Rather than use the names "fial" and "kep", use "fail" and "keep". In
> the DO_TEST() macro, to prevent the preprocessor replacing the struct
> member names during assignment, use the names "fail_" and "keep_"
> instead.

Heh.


Reviewed-by: Laine Stump <laine@redhat.com>

and pushed.


>
> Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
> ---
>   tests/qemuhotplugtest.c | 18 +++++++++---------
>   1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
> index 1e18820a2b..b023c49a69 100644
> --- a/tests/qemuhotplugtest.c
> +++ b/tests/qemuhotplugtest.c
> @@ -641,28 +641,28 @@ mymain(void)
>       }
>   
>   
> -#define DO_TEST(file, ACTION, dev, fial, kep, ...) \
> +#define DO_TEST(file, ACTION, dev, fail_, keep_, ...) \
>       do { \
>           const char *my_mon[] = { __VA_ARGS__, NULL}; \
>           const char *name = file " " #ACTION " " dev; \
>           data.action = ACTION; \
>           data.domain_filename = file; \
>           data.device_filename = dev; \
> -        data.fail = fial; \
> +        data.fail = fail_; \
>           data.mon = my_mon; \
> -        data.keep = kep; \
> +        data.keep = keep_; \
>           if (virTestRun(name, testQemuHotplug, &data) < 0) \
>               ret = -1; \
>       } while (0)
>   
> -#define DO_TEST_ATTACH(file, dev, fial, kep, ...) \
> -    DO_TEST(file, ATTACH, dev, fial, kep, __VA_ARGS__)
> +#define DO_TEST_ATTACH(file, dev, fail, keep, ...) \
> +    DO_TEST(file, ATTACH, dev, fail, keep, __VA_ARGS__)
>   
> -#define DO_TEST_DETACH(file, dev, fial, kep, ...) \
> -    DO_TEST(file, DETACH, dev, fial, kep, __VA_ARGS__)
> +#define DO_TEST_DETACH(file, dev, fail, keep, ...) \
> +    DO_TEST(file, DETACH, dev, fail, keep, __VA_ARGS__)
>   
> -#define DO_TEST_UPDATE(file, dev, fial, kep, ...) \
> -    DO_TEST(file, UPDATE, dev, fial, kep, __VA_ARGS__)
> +#define DO_TEST_UPDATE(file, dev, fail, keep, ...) \
> +    DO_TEST(file, UPDATE, dev, fail, keep, __VA_ARGS__)
>   
>   
>   #define QMP_OK      "{\"return\": {}}"