All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Wang <liwang@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 2/4] lib: Check also flags for tst_res()
Date: Fri, 28 Feb 2020 15:00:24 +0800	[thread overview]
Message-ID: <CAEemH2fTYf91KP6_Kf343taLmoGeTuOvNJWVr1qf5C-02+CZpQ@mail.gmail.com> (raw)
In-Reply-To: <20200227163922.317-2-pvorel@suse.cz>

Hi Petr,

Thanks for your work on this!

On Fri, Feb 28, 2020 at 12:39 AM Petr Vorel <pvorel@suse.cz> wrote:

> Allowed types: TCONF | TFAIL | TINFO | TPASS | TWARN
> i.e. TBROK is forbidden.
>
> Suggested-by: Li Wang <liwang@redhat.com>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> Hi,
>
> TPASS == 0, that's why TTYPE_RESULT(ttype) ?: TCONF
>
> Kind regards,
> Petr
>
>  include/tst_common.h | 3 +++
>  include/tst_test.h   | 6 +++++-
>  2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/include/tst_common.h b/include/tst_common.h
> index d37e38487..54a8428fd 100644
> --- a/include/tst_common.h
> +++ b/include/tst_common.h
> @@ -77,4 +77,7 @@
>  #define TST_BRK_SUPPORTS_ONLY_TCONF_TBROK(condition) \
>         do { ((void)sizeof(char[1 - 2 * !!(condition)])); } while (0)
>
> +#define TST_RES_SUPPORTS_TCONF_TFAIL_TINFO_TPASS_TWARN(condition) \
> +       TST_BRK_SUPPORTS_ONLY_TCONF_TBROK(condition)
>

To be honest, this looks verbose and confusing a little. I'm thinking can
we just add a prefix TST_ to the kernel macro and use it directly?

e.g

#define TST_BUILD_BUG_ON(condition) \
        do { ((void)sizeof(char[1 - 2 * !!(condition)])); } while (0)



> +
>  #endif /* TST_COMMON_H__ */
> diff --git a/include/tst_test.h b/include/tst_test.h
> index 1026a422a..8508c2e38 100644
> --- a/include/tst_test.h
> +++ b/include/tst_test.h
> @@ -47,7 +47,11 @@ void tst_res_(const char *file, const int lineno, int
> ttype,
>                __attribute__ ((format (printf, 4, 5)));
>
>  #define tst_res(ttype, arg_fmt, ...) \
> -       tst_res_(__FILE__, __LINE__, (ttype), (arg_fmt), ##__VA_ARGS__)
> +       ({
>       \
> +
>  TST_RES_SUPPORTS_TCONF_TFAIL_TINFO_TPASS_TWARN(!((TTYPE_RESULT(ttype) ?:
> TCONF) & \
> +                       (TCONF | TFAIL | TINFO | TPASS | TWARN)));
>                       \
> +               tst_res_(__FILE__, __LINE__, (ttype), (arg_fmt),
> ##__VA_ARGS__);\
> +       })
>
>  void tst_resm_hexd_(const char *file, const int lineno, int ttype,
>         const void *buf, size_t size, const char *arg_fmt, ...)
> --
> 2.25.1
>
>

-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200228/849620a9/attachment-0001.htm>

  reply	other threads:[~2020-02-28  7:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-27 16:39 [LTP] [PATCH 1/4] Avoid using tst_res(TBROK) Petr Vorel
2020-02-27 16:39 ` [LTP] [PATCH 2/4] lib: Check also flags for tst_res() Petr Vorel
2020-02-28  7:00   ` Li Wang [this message]
2020-02-28  7:05     ` Petr Vorel
2020-02-28 12:13     ` Cyril Hrubis
2020-02-28 13:17       ` Petr Vorel
2020-02-28 14:17         ` Petr Vorel
2020-02-27 16:39 ` [LTP] [PATCH 3/4] doc: Improve flags info Petr Vorel
2020-02-27 16:39 ` [LTP] [PATCH 4/4] doc: Update style guide to new API Petr Vorel
2020-02-28  7:24   ` Li Wang
2020-02-28  8:42     ` Petr Vorel
2020-02-28  9:22       ` Jan Stancek
2020-02-28  9:55         ` Petr Vorel
2020-03-04 11:38           ` Petr Vorel
2020-02-28  7:47 ` [LTP] [PATCH 1/4] Avoid using tst_res(TBROK) Li Wang
2020-02-28  8:46   ` Petr Vorel

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=CAEemH2fTYf91KP6_Kf343taLmoGeTuOvNJWVr1qf5C-02+CZpQ@mail.gmail.com \
    --to=liwang@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.