public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/1] tst_test_macros.h: Print also returned value
@ 2021-12-20 19:51 Petr Vorel
  2021-12-21 12:14 ` Cyril Hrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2021-12-20 19:51 UTC (permalink / raw)
  To: ltp

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


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

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

end of thread, other threads:[~2021-12-21 12:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-20 19:51 [LTP] [PATCH 1/1] tst_test_macros.h: Print also returned value Petr Vorel
2021-12-21 12:14 ` Cyril Hrubis
2021-12-21 12:51   ` Petr Vorel

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