Skip to contentSkip to conversation

lib: tst_res(): Fix TDEBUG | TERRNO

PATCH In review Cyril Hrubis 5 participants 7 messages Aug 4 – Aug 6 Library code

lore
Share & tools
lore
#0 lore raw

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
index cda097070..f4aaa0439 100644
@@ -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
index 5c3607016..9c5f2617f 100644
@@ -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
Acked-by Jan Stancek on v1 1/1
#2 lore raw
In reply to Cyril Hrubis
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.

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
index cda097070..f4aaa0439 100644
@@ -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
index 5c3607016..9c5f2617f 100644
@@ -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
#3 lore raw
In reply to Cyril Hrubis

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
Reviewed-by on v1 1/1
#5 lore raw
In reply to Cyril Hrubis

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.

Fixes 018f555a44 ("lib: Add support for TDEBUG tst_res() flag")

Thanks for fixing my bug!

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#6 lore raw

Hi!
Thanks for the reviews, pushed.

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp