lib: tst_res(): Fix TDEBUG | TERRNO
PATCH 1/1 lib: tst_res(): Fix TDEBUG | TERRNO
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.
--- lib/newlib_tests/tst_res_flags.c | 1 + lib/tst_test.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
lib/newlib_tests/tst_res_flags.c +1 -0
@@ -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)
lib/tst_test.c +1 -1
@@ -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 ;
Signature · 5 lines
2.54.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 6 lines · Cyril Hrubis
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]>
Quoted 37 lines
--- lib/newlib_tests/tst_res_flags.c | 1 + lib/tst_test.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)lib/newlib_tests/tst_res_flags.c +1
-0@@ -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)lib/tst_test.c +1
-2@@ -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
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Cyril,
Quoted 1 line · Cyril Hrubis
lib:
tst_res(): Fix TDEBUG | TERRNO
Verdict - Reviewed
---
Note:
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 5 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Cyril,
Quoted 3 lines
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.
Thanks for fixing my bug!
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Thanks for the reviews, pushed.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp