[LTP] [PATCH 4/5] lib/tst_res_.c: Add TBROK handler + more verbose errors
Petr Vorel
pvorel@suse.cz
Wed Dec 11 01:11:06 CET 2024
> We use the tst_res_ helper for tst_brk_ as well so we need to be able to
> handle TBROK type as well.
How can we call tst_brk_() via tst_res_() ?
tst_res_(argv[1], atoi(argv[2]), type, "%s", msg);
Also we have TST_RES_SUPPORTS_TCONF_TDEBUG_TFAIL_TINFO_TPASS_TWARN check to not
add TBROK to tst_res_().
...
> - else if (!strcmp(argv[3], "TINFO"))
> + } else if (!strcmp(argv[3], "TINFO")) {
> type = TINFO;
> - else if (!strcmp(argv[3], "TDEBUG"))
> + } else if (!strcmp(argv[3], "TDEBUG")) {
> type = TDEBUG;
> - else
> + } else if (!strcmp(argv[3], "TBROK")) {
> + type = TBROK;
> + } else {
> + printf("Wrong type '%s'\n", argv[3]);
> goto help;
Also tst_brk allows only TBROK and TCONF in C:
#define tst_brk(ttype, arg_fmt, ...) \
({ \
TST_BRK_SUPPORTS_ONLY_TCONF_TBROK(!((ttype) & \
(TBROK | TCONF | TFAIL))); \
tst_brk_(__FILE__, __LINE__, (ttype), (arg_fmt), ##__VA_ARGS__);\
})
... and shell:
if [ "$res" != TBROK -a "$res" != TCONF ]; then
tst_res TBROK "tst_brk can be called only with TBROK or TCONF ($res)"
else
tst_res "$res" "$@"
fi
Kind regards,
Petr
More information about the ltp
mailing list