From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [RFC PATCH v2 1/2] include/tst_test_macros.h: Add TST_EXP_SILENT_{PASS, FD} macros
Date: Mon, 11 Jan 2021 15:07:36 +0100 [thread overview]
Message-ID: <X/xbqGf+q8LQkXCw@yuki.lan> (raw)
In-Reply-To: <20210110130436.9514-1-yangx.jy@cn.fujitsu.com>
Hi!
> 1) TST_EXP_SILENT_{PASS,FD} don't report TPASS when SCALL succeeds.
> 2) TST_EXP_{PASS,FD} calls TST_EXP_SILENT_{PASS,FD} and report
> TPASS when SCALL succeeds.
I think that the macros should have the silent after the {PASS,FD} since
that would be less confusing. I other words what is silent fd?
So I would name these as TST_EXP_FD_SILENT() or maybe
TST_EXP_FD_QUIET().
Other than that the change looks good.
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> ---
> include/tst_test_macros.h | 25 ++++++++++++++++++-------
> 1 file changed, 18 insertions(+), 7 deletions(-)
>
> diff --git a/include/tst_test_macros.h b/include/tst_test_macros.h
> index 3016d95c2..8b71da00b 100644
> --- a/include/tst_test_macros.h
> +++ b/include/tst_test_macros.h
> @@ -46,7 +46,7 @@ extern void *TST_RET_PTR;
> tst_res_(__FILE__, __LINE__, RES, \
> TST_FMT_(TST_2_(dummy, ##__VA_ARGS__, SCALL) FMT, __VA_ARGS__), PAR)
>
> -#define TST_EXP_FD(SCALL, ...) \
> +#define TST_EXP_SILENT_FD(SCALL, ...) \
> do { \
> TEST(SCALL); \
> \
> @@ -64,14 +64,20 @@ extern void *TST_RET_PTR;
> break; \
> } \
> \
> - TST_MSGP_(TPASS, " returned fd %ld", TST_RET, \
> - #SCALL, ##__VA_ARGS__); \
> - \
> TST_PASS = 1; \
> \
> } while (0)
>
> -#define TST_EXP_PASS(SCALL, ...) \
> +#define TST_EXP_FD(SCALL, ...) \
> + do { \
> + TST_EXP_SILENT_FD(SCALL, __VA_ARGS__); \
> + \
> + if (TST_PASS) \
> + TST_MSGP_(TPASS, " returned fd %ld", TST_RET, \
> + #SCALL, ##__VA_ARGS__); \
> + } while (0)
> +
> +#define TST_EXP_SILENT_PASS(SCALL, ...) \
> do { \
> TEST(SCALL); \
> \
> @@ -89,12 +95,17 @@ extern void *TST_RET_PTR;
> break; \
> } \
> \
> - TST_MSG_(TPASS, " passed", #SCALL, ##__VA_ARGS__); \
> - \
> TST_PASS = 1; \
> \
> } while (0)
>
> +#define TST_EXP_PASS(SCALL, ...) \
> + do { \
> + TST_EXP_SILENT_PASS(SCALL, __VA_ARGS__); \
> + \
> + if (TST_PASS) \
> + TST_MSG_(TPASS, " passed", #SCALL, ##__VA_ARGS__); \
> + } while (0) \
>
> #define TST_EXP_FAIL(SCALL, ERRNO, ...) \
> do { \
> --
> 2.21.0
>
>
>
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2021-01-11 14:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-04 12:54 [LTP] [PATCH 1/2] syscalls/open01.c: Don't continue when open() failed Xiao Yang
2021-01-04 12:54 ` [LTP] [RFC PATCH 2/2] include/tst_test_macros.h: Report TINFO when TST_EXP_FD() succeeded Xiao Yang
2021-01-04 13:07 ` yangx.jy
2021-01-05 13:38 ` Cyril Hrubis
2021-01-05 13:36 ` Cyril Hrubis
2021-01-05 14:39 ` yangx.jy
2021-01-05 15:03 ` Cyril Hrubis
2021-01-10 13:04 ` [LTP] [RFC PATCH v2 1/2] include/tst_test_macros.h: Add TST_EXP_SILENT_{PASS, FD} macros Xiao Yang
2021-01-10 13:04 ` [LTP] [RFC PATCH v2 2/2] syscalls/access02.c: Take use of TST_EXP_SILENT_PASS Xiao Yang
2021-01-11 14:07 ` Cyril Hrubis [this message]
2021-01-10 13:48 ` [LTP] [RFC PATCH 2/2] include/tst_test_macros.h: Report TINFO when TST_EXP_FD() succeeded yangx.jy
2021-01-05 13:15 ` [LTP] [PATCH 1/2] syscalls/open01.c: Don't continue when open() failed Cyril Hrubis
2021-01-05 14:20 ` yangx.jy
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=X/xbqGf+q8LQkXCw@yuki.lan \
--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