Re: [LTP] [PATCH] lib: tst_res(): Fix TDEBUG | TERRNO

Jan Stancek via ltp <[email protected]>
Newsgroups it.linux.lists.ltp
Message-ID <CAASaF6zS3gX8YMcx+nXv2xTfx+NfSRnf-_s3fCC_F8CppCC6_Q@mail.gmail.com>
On Tue, Aug 4, 2026 at 3:29 PM Cyril Hrubis <[email protected]> wrote:
>
> Properly mask the ttype with TTYPE_MASK() when deciding if TDEBUG
> messages should be printed, otherwise any combination of TERRNO etc.
> flags is printed regardless the -D flag.
>
> Signed-off-by: Cyril Hrubis <[email protected]>

Acked-by: Jan Stancek <[email protected]>

> ---
>  lib/newlib_tests/tst_res_flags.c | 1 +
>  lib/tst_test.c                   | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lib/newlib_tests/tst_res_flags.c b/lib/newlib_tests/tst_res_flags.c
> index cda097070..f4aaa0439 100644
> --- a/lib/newlib_tests/tst_res_flags.c
> +++ b/lib/newlib_tests/tst_res_flags.c
> @@ -22,6 +22,7 @@ static struct tcase {
>         {FLAG(TWARN)},
>         {FLAG(TINFO)},
>         {FLAG(TDEBUG), " (printed only with -D[1,2] or LTP_DEBUG=1(y),2)"},
> +       {FLAG(TDEBUG | TERRNO), " (printed only with -D[1,2] or LTP_DEBUG=1(y),2)"},
>  };
>
>  static void do_cleanup(void)
> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index 5c3607016..9c5f2617f 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -495,7 +495,7 @@ void tst_res_(const char *file, const int lineno, int ttype,
>          * 3. Debug output is only for test process (context->tdebug == 1).
>          * 4. Debug output is enabled for both test and lib processes (context->tdebug == 2).
>          */
> -       if (ttype == TDEBUG) {
> +       if (TTYPE_RESULT(ttype) == TDEBUG) {
>                 if (!context)
>                         return;
>
> --
> 2.54.0
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
>


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.