[LTP] [PATCH v3 1/2] tst_test_macros.h: Add TST_EXP_EQ_STR
Petr Vorel
pvorel@suse.cz
Thu Aug 11 15:57:30 CEST 2022
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
new in v3
include/tst_test_macros.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/include/tst_test_macros.h b/include/tst_test_macros.h
index c8f7825c4..8cc959243 100644
--- a/include/tst_test_macros.h
+++ b/include/tst_test_macros.h
@@ -242,4 +242,14 @@ extern void *TST_RET_PTR;
#define TST_EXP_EQ_SSZ(VAL_A, VAL_B) \
TST_EXP_EQ_(VAL_A, #VAL_A, VAL_B, #VAL_B, ssize_t, "%zi")
+#define TST_EXP_EQ_STR(STR_A, STR_B) do {\
+ if (strcmp(STR_A, STR_B)) { \
+ tst_res_(__FILE__, __LINE__, TFAIL, \
+ "'%s' != '%s'", STR_A, STR_B); \
+ } else { \
+ tst_res_(__FILE__, __LINE__, TPASS, \
+ "'%s' == '%s'", STR_A, STR_B); \
+ } \
+} while (0)
+
#endif /* TST_TEST_MACROS_H__ */
--
2.37.1
More information about the ltp
mailing list