[LTP] [PATCH 1/1] tst_test_macros.h: Print also returned value

Petr Vorel pvorel@suse.cz
Mon Dec 20 20:51:11 CET 2021


in TST_EXP_VAL*() macros.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
NOTE: tst_test_macros.h would also deserve documentation of "public"
macros (to save people read all nested definitions.

Kind regards,
Petr

 include/tst_test_macros.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/tst_test_macros.h b/include/tst_test_macros.h
index 4a023b700a..dd959cad63 100644
--- a/include/tst_test_macros.h
+++ b/include/tst_test_macros.h
@@ -46,6 +46,10 @@ extern void *TST_RET_PTR;
 	tst_res_(__FILE__, __LINE__, RES, \
 		TST_FMT_(TST_2_(dummy, ##__VA_ARGS__, SCALL) FMT, __VA_ARGS__), PAR)
 
+#define TST_MSGP2_(RES, FMT, PAR, PAR2, SCALL, ...) \
+	tst_res_(__FILE__, __LINE__, RES, \
+		TST_FMT_(TST_2_(dummy, ##__VA_ARGS__, SCALL) FMT, __VA_ARGS__), PAR, PAR2)
+
 #define TST_EXP_POSITIVE_(SCALL, SSCALL, ...)                                  \
 	do {                                                                   \
 		TEST(SCALL);                                                   \
@@ -107,8 +111,8 @@ extern void *TST_RET_PTR;
 		TST_PASS = 0;                                                  \
 		                                                               \
 		if (TST_RET != VAL) {                                          \
-			TST_MSGP_(TFAIL | TTERRNO, " retval not %ld",          \
-			          (long )VAL, SSCALL, ##__VA_ARGS__);          \
+			TST_MSGP2_(TFAIL | TTERRNO, " retval not %ld (%ld)",          \
+			          (long)VAL, TST_RET, SSCALL, ##__VA_ARGS__);          \
 			break;                                                 \
 		}                                                              \
 		                                                               \
-- 
2.34.1



More information about the ltp mailing list