From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/3] tst_test_macros: Fix TST_EXP_*() default message
Date: Mon, 23 Aug 2021 17:05:18 +0200 [thread overview]
Message-ID: <20210823150520.25614-2-chrubis@suse.cz> (raw)
In-Reply-To: <20210823150520.25614-1-chrubis@suse.cz>
We have to erase the last comma because otherwise we pass down one more
empty parameter to the TST_EXP_*_() macros which then causes the FMT
string to be empty and we end up with an empty default message.
Consider for example:
TST_EXP_FD(open(fname, O_RDONLY));
Before the patch it would produce:
foo.c:12: TPASS: returned fd 4
After it would produce:
foo.c:12: TPASS: open(fname, O_RDONLY) returned fd 4
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
include/tst_test_macros.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/tst_test_macros.h b/include/tst_test_macros.h
index d9d7f930f..ecc612b0d 100644
--- a/include/tst_test_macros.h
+++ b/include/tst_test_macros.h
@@ -70,7 +70,7 @@ extern void *TST_RET_PTR;
#define TST_EXP_POSITIVE(SCALL, ...) \
do { \
- TST_EXP_POSITIVE_(SCALL, __VA_ARGS__); \
+ TST_EXP_POSITIVE_(SCALL, ##__VA_ARGS__); \
\
if (TST_PASS) { \
TST_MSGP_(TPASS, " returned %ld", \
@@ -78,22 +78,22 @@ extern void *TST_RET_PTR;
} \
} while (0)
-#define TST_EXP_FD_SILENT(SCALL, ...) TST_EXP_POSITIVE_(SCALL, __VA_ARGS__)
+#define TST_EXP_FD_SILENT(SCALL, ...) TST_EXP_POSITIVE_(SCALL, ##__VA_ARGS__)
#define TST_EXP_FD(SCALL, ...) \
do { \
- TST_EXP_FD_SILENT(SCALL, __VA_ARGS__); \
+ TST_EXP_FD_SILENT(SCALL, ##__VA_ARGS__); \
\
if (TST_PASS) \
TST_MSGP_(TPASS, " returned fd %ld", TST_RET, \
#SCALL, ##__VA_ARGS__); \
} while (0)
-#define TST_EXP_PID_SILENT(SCALL, ...) TST_EXP_POSITIVE_(SCALL, __VA_ARGS__)
+#define TST_EXP_PID_SILENT(SCALL, ...) TST_EXP_POSITIVE_(SCALL, ##__VA_ARGS__)
#define TST_EXP_PID(SCALL, ...) \
do { \
- TST_EXP_PID_SILENT(SCALL, __VA_ARGS__); \
+ TST_EXP_PID_SILENT(SCALL, ##__VA_ARGS__); \
\
if (TST_PASS) \
TST_MSGP_(TPASS, " returned pid %ld", TST_RET, \
@@ -124,7 +124,7 @@ extern void *TST_RET_PTR;
#define TST_EXP_PASS(SCALL, ...) \
do { \
- TST_EXP_PASS_SILENT(SCALL, __VA_ARGS__); \
+ TST_EXP_PASS_SILENT(SCALL, ##__VA_ARGS__); \
\
if (TST_PASS) \
TST_MSG_(TPASS, " passed", #SCALL, ##__VA_ARGS__); \
@@ -158,8 +158,8 @@ extern void *TST_RET_PTR;
} \
} while (0)
-#define TST_EXP_FAIL(SCALL, ERRNO, ...) TST_EXP_FAIL_(TST_RET == 0, SCALL, ERRNO, __VA_ARGS__)
+#define TST_EXP_FAIL(SCALL, ERRNO, ...) TST_EXP_FAIL_(TST_RET == 0, SCALL, ERRNO, ##__VA_ARGS__)
-#define TST_EXP_FAIL2(SCALL, ERRNO, ...) TST_EXP_FAIL_(TST_RET >= 0, SCALL, ERRNO, __VA_ARGS__)
+#define TST_EXP_FAIL2(SCALL, ERRNO, ...) TST_EXP_FAIL_(TST_RET >= 0, SCALL, ERRNO, ##__VA_ARGS__)
#endif /* TST_TEST_MACROS_H__ */
--
2.31.1
next prev parent reply other threads:[~2021-08-23 15:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-23 15:05 [LTP] [PATCH 0/3] TST_EXP_*() macros fixes Cyril Hrubis
2021-08-23 15:05 ` Cyril Hrubis [this message]
2021-08-24 7:35 ` [LTP] [PATCH 1/3] tst_test_macros: Fix TST_EXP_*() default message Li Wang
2021-08-24 8:48 ` Cyril Hrubis
2021-08-24 9:29 ` Li Wang
2021-08-24 12:46 ` Richard Palethorpe
2021-08-24 11:48 ` Petr Vorel
2021-08-24 13:37 ` Cyril Hrubis
2021-08-23 15:05 ` [LTP] [PATCH 2/3] tst_test_macros: Stringify early Cyril Hrubis
2021-08-23 15:05 ` [LTP] [PATCH 3/3] tst_test_macros: Add test_macros05 tests Cyril Hrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210823150520.25614-2-chrubis@suse.cz \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox