[LTP] [RFC PATCH 1/2] lib: add TST_RES_ serious macros
Cyril Hrubis
chrubis@suse.cz
Wed Jun 26 13:53:37 CEST 2024
Hi!
> This patch introduces new macros to encapsulate existing tst_res and
> tst_brk functions in the LTP library. These macros simplify the usage
> of tst_ functions by providing a more user-friendly interface for
> generating standardized test output.
>
> TST_RES_TINFO() -> tst_res(TINFO, ...)
> TST_RES_TWARN() -> tst_res(TINFO, "WARNING: ", ...)
> TST_RES_TPASS() -> tst_res(TPASS, ...)
> TST_RES_TDEBUG() -> tst_res(TDEBUG, ...)
> TST_RES_TFAIL() -> tst_res(TFAIL, ...)
>
> TST_BRK_TCONF() -> tst_brk(TCONF, ...)
> TST_BRK_TBROK() -> tst_brk(TBROK, ...)
>
> TST_RES_TPASS_ER() -> tst_res(TPASS | errno, ...)
> TST_RES_TFAIL_ER() -> tst_res(TFAIL | errno, ...)
> TST_BRK_TBROK_ER() -> tst_brk(TBROK | errno, ... )
>
> The macros handle various scenarios including simple messages and messages
> with error flags, ensuring consistent logging of file and line information.
>
> Additionally, a new test case in tst_res_macros.c demonstrates the usage
> of these macros.
I actually like the function better. It makes sense to add macros when
they do something more complicated e.g. the TST_EXP_ macros save a lot
of code, but in this case I do not think that they add any value, the
change is only cosmetic.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list