[LTP] [PATCH v3 1/2] tst_test_macros.h: Add TST_EXP_EQ_STR

xuyang2018.jy@fujitsu.com xuyang2018.jy@fujitsu.com
Mon Aug 15 05:17:57 CEST 2022


Hi Petr

Looks good to me,
Reviewed-by: Yang Xu <xuyang2018.jy@fujitsu.com>

Best Regards
Yang Xu
> 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__ */


More information about the ltp mailing list