[LTP] [PATCH v5 1/3] lib: TST_EXP_{FAIL,PASS}_PTR_{NULL,VOID}

Petr Vorel pvorel@suse.cz
Thu Mar 28 13:11:04 CET 2024


Hi Wei,

...
>  #define TST_EXP_FAIL_ARR_(SCALL, SSCALL, EXP_ERRS, EXP_ERRS_CNT, ...)          \
>  	do {                                                                   \
>  		TST_EXP_FAIL_SILENT_(TST_RET == 0, SCALL, SSCALL,              \
> @@ -258,6 +293,32 @@ const char *tst_errno_names(char *buf, const int *exp_errs, int exp_errs_cnt);
>  		TST_EXP_FAIL2_ARR_(SCALL, #SCALL, EXP_ERRS,                    \
>  		                  ARRAY_SIZE(EXP_ERRS), ##__VA_ARGS__);

> +#define TST_EXP_FAIL_PTR_NULL(SCALL, EXP_ERR, ...)                             \
> +	do {                                                                   \
> +		int tst_exp_err__ = EXP_ERR;                                   \
> +		TST_EXP_FAIL_PTR_(SCALL, #SCALL, NULL,                         \
> +			&tst_exp_err__, 1, ##__VA_ARGS__);                     \
> +	} while (0)
> +
> +#define TST_EXP_FAIL_PTR_ARR_NULL(SCALL, EXP_ERRS, ...)                        \
> +	do {                                                                   \
> +		TST_EXP_FAIL_PTR_(SCALL, #SCALL, NULL,                         \
> +			EXP_ERRS, ARRAY_SIZE(EXP_ERRS), ##__VA_ARGS__);        \

FYI I send a patch [1] (Cyril's suggestion) replacing ARRAY_SIZE() with just
size parameter. I.e. moving ARRAY_SIZE() to the caller. This allows to use array
of expected errnos more flexibly, e.g. fanotify14 [2].

Could you please send another version, which will be based on my v3 patchset or
just wait before it's merged and rebase?

Kind regards,
Petr

[1] https://lore.kernel.org/ltp/20240326144145.747735-3-pvorel@suse.cz/
[2] https://lore.kernel.org/ltp/20240326144145.747735-4-pvorel@suse.cz/
[3] https://patchwork.ozlabs.org/project/ltp/list/?series=400495

> +	} while (0)
> +
> +#define TST_EXP_FAIL_PTR_VOID(SCALL, EXP_ERR, ...)                             \
> +	do {                                                                   \
> +		int tst_exp_err__ = EXP_ERR;                                   \
> +		TST_EXP_FAIL_PTR_(SCALL, #SCALL, (void *)-1,                   \
> +			&tst_exp_err__, 1, ##__VA_ARGS__);                     \
> +	} while (0)
> +
> +#define TST_EXP_FAIL_PTR_ARR_VOID(SCALL, EXP_ERRS, ...)                        \
> +	do {                                                                   \
> +		TST_EXP_FAIL_PTR_(SCALL, #SCALL, (void *)-1,                   \
> +			EXP_ERRS, ARRAY_SIZE(EXP_ERRS), ##__VA_ARGS__);        \
> +	} while (0)
> +


More information about the ltp mailing list