[LTP] [PATCH v5 1/3] lib: TST_EXP_{FAIL,PASS}_PTR_{NULL,VOID}
Petr Vorel
pvorel@suse.cz
Thu Mar 28 12:57:20 CET 2024
Hi Wei,
> Hi Wei,
...
> #define TEST_MACRO(macro, macro_arr, fail_fn, pass_fn, inval_fn) \
> do { \
> tst_res(TINFO, "Testing macro macro"); \
> macro(fail_fn(), EINVAL, "fail_fn()"); \
> tst_res(TINFO, "TST_PASS = %i", TST_PASS); \
> macro(fail_fn(), ENOTTY, "fail_fn()"); \
> tst_res(TINFO, "TST_PASS = %i", TST_PASS); \
> macro(pass_fn(), ENOTTY, "pass_fn()"); \
> tst_res(TINFO, "TST_PASS = %i", TST_PASS); \
> macro(inval_fn(), ENOTTY, "inval_fn()"); \
> tst_res(TINFO, "TST_PASS = %i", TST_PASS); \
> macro_arr(fail_fn(), exp_errs_pass, "fail_fn()"); \
> tst_res(TINFO, "TST_PASS = %i", TST_PASS); \
> macro_arr(fail_fn(), exp_errs_fail, "fail_fn()"); \
> tst_res(TINFO, "TST_PASS = %i", TST_PASS); \
> } while (0)
Actually this (print real function with #macro and #macro_arr,
2x skip message parameter (to test also macro without error parameter):
#define TEST_MACRO(macro, macro_arr, fail_fn, pass_fn, inval_fn) \
do { \
tst_res(TINFO, "Testing " #macro " macro"); \
macro(fail_fn(), EINVAL, #fail_fn"()"); \
tst_res(TINFO, "TST_PASS = %i", TST_PASS); \
macro(fail_fn(), ENOTTY); /* skip msg parameter */ \
tst_res(TINFO, "TST_PASS = %i", TST_PASS); \
macro(pass_fn(), ENOTTY, #pass_fn"()"); \
tst_res(TINFO, "TST_PASS = %i", TST_PASS); \
macro(inval_fn(), ENOTTY, #inval_fn"()"); \
tst_res(TINFO, "TST_PASS = %i", TST_PASS); \
macro_arr(fail_fn(), exp_errs_pass, #fail_fn"()"); \
tst_res(TINFO, "TST_PASS = %i", TST_PASS); \
macro_arr(fail_fn(), exp_errs_fail); /* skip msg parameter */ \
tst_res(TINFO, "TST_PASS = %i", TST_PASS); \
} while (0)
Kind regards,
Petr
More information about the ltp
mailing list