Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH] lib: tst_res(): Fix TDEBUG | TERRNO
@ 2026-08-04 13:28 Cyril Hrubis
  2026-08-04 13:51 ` Andrea Cervesato via ltp
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Cyril Hrubis @ 2026-08-04 13:28 UTC (permalink / raw)
  To: ltp

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-08-06  8:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-04 13:28 [LTP] [PATCH] lib: tst_res(): Fix TDEBUG | TERRNO Cyril Hrubis
2026-08-04 13:51 ` Andrea Cervesato via ltp
2026-08-04 14:01 ` Jan Stancek via ltp
2026-08-04 16:13 ` [LTP] " linuxtestproject.agent
2026-08-05  2:44 ` [LTP] [PATCH] " Li Wang
2026-08-05 10:09 ` Petr Vorel
2026-08-06  8:34   ` Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox