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

Jan Stancek jstancek@redhat.com
Tue Aug 4 16:01:58 CEST 2026


On Tue, Aug 4, 2026 at 3:29 PM Cyril Hrubis <chrubis@suse.cz> 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 <chrubis@suse.cz>

Acked-by: Jan Stancek <jstancek@redhat.com>

> ---
>  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
>



More information about the ltp mailing list