[PATCH 04/15] tests: Move ARG_STR and similar macros to tests.h

Eugene Syromyatnikov evgsyr at gmail.com
Sat Oct 15 01:25:11 UTC 2016


* tests/add_key.c (_STR, ARG_STR): Moved to tests.h.
* tests/ioctl_dm.c (ARG_STR): Likewise.
* tests/keyctl.c (ARG_STR): Likewise.
* tests/perf_event_open_verbose.c (ARG_STR, ARG_ULL_STR): Likewise.
* tests/quotactl.h (ARG_STR): Likewise.
* tests/request_key.c (ARG_STR): Likewise.
* tests/tests.h: Add definitions of _STR, ARG_STR, ARG_ULL_STR macros.
---
 tests/add_key.c                 |    3 ---
 tests/ioctl_dm.c                |    2 --
 tests/keyctl.c                  |    2 --
 tests/perf_event_open_verbose.c |    2 --
 tests/quotactl.h                |    2 --
 tests/request_key.c             |    3 ---
 tests/tests.h                   |    4 ++++
 7 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/tests/add_key.c b/tests/add_key.c
index 62f4be3..57f12bf 100644
--- a/tests/add_key.c
+++ b/tests/add_key.c
@@ -65,9 +65,6 @@ do_add_key(const char *type, const char *type_str, const char *desc,
 	printf(") = %s\n", errstr);
 }
 
-# define _STR(_arg) #_arg
-# define ARG_STR(_arg) (_arg), #_arg
-
 int
 main(void)
 {
diff --git a/tests/ioctl_dm.c b/tests/ioctl_dm.c
index 2fcd430..3ab4ee4 100644
--- a/tests/ioctl_dm.c
+++ b/tests/ioctl_dm.c
@@ -119,8 +119,6 @@ print_dm_target_spec(struct dm_target_spec *ptr, uint32_t id)
 }
 # endif /* VERBOSE */
 
-# define ARG_STR(_arg) (_arg), #_arg
-
 int
 main(void)
 {
diff --git a/tests/keyctl.c b/tests/keyctl.c
index b580981..a60dcfc 100644
--- a/tests/keyctl.c
+++ b/tests/keyctl.c
@@ -190,8 +190,6 @@ do_keyctl(kernel_ulong_t cmd, const char *cmd_str, ...)
 	printf(") = %s\n", errstr);
 }
 
-# define ARG_STR(_arg) (_arg), #_arg
-
 int
 main(void)
 {
diff --git a/tests/perf_event_open_verbose.c b/tests/perf_event_open_verbose.c
index 3517b5f..21bc268 100644
--- a/tests/perf_event_open_verbose.c
+++ b/tests/perf_event_open_verbose.c
@@ -474,8 +474,6 @@ end:
 }
 
 # define ATTR_REC(sz) { tail_alloc(sz), sz }
-# define ARG_STR(_arg) (_arg), #_arg
-# define ARG_ULL_STR(_arg) _arg##ULL, #_arg
 
 # define BRANCH_TYPE_ALL \
 	"PERF_SAMPLE_BRANCH_USER|" \
diff --git a/tests/quotactl.h b/tests/quotactl.h
index b97153f..edde915 100644
--- a/tests/quotactl.h
+++ b/tests/quotactl.h
@@ -69,8 +69,6 @@
 	printf("%s%s=%#llx", (prefix), #field,	\
 	       zero_extend_signed_to_ull((where)->field))
 
-# define ARG_STR(_arg) (_arg), #_arg
-
 typedef void (*print_cb)(long rc, void *addr, void *arg);
 
 enum check_quotactl_flag_bits {
diff --git a/tests/request_key.c b/tests/request_key.c
index 361bf52..d88cd1e 100644
--- a/tests/request_key.c
+++ b/tests/request_key.c
@@ -64,9 +64,6 @@ do_request_key(const char *type, const char *type_str, const char *desc,
 	printf(") = %s\n", errstr);
 }
 
-# define _STR(_arg) #_arg
-# define ARG_STR(_arg) (_arg), #_arg
-
 int
 main(void)
 {
diff --git a/tests/tests.h b/tests/tests.h
index a557805..9d660a0 100644
--- a/tests/tests.h
+++ b/tests/tests.h
@@ -186,4 +186,8 @@ int send_mmsg(int, struct mmsghdr *, unsigned int, unsigned int);
 # endif
 # define LL_VAL_TO_PAIR(llval) LL_PAIR((long) ((llval) >> 32), (long) (llval))
 
+# define _STR(_arg) #_arg
+# define ARG_STR(_arg) (_arg), #_arg
+# define ARG_ULL_STR(_arg) _arg##ULL, #_arg
+
 #endif /* !STRACE_TESTS_H */
-- 
1.7.10.4





More information about the Strace-devel mailing list