[LTP] [PATCH 4/5] lib/tst_res_.c: Add TBROK handler + more verbose errors
Cyril Hrubis
chrubis@suse.cz
Wed Dec 11 10:52:42 CET 2024
Hi!
> > 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);
In the end both of these functions increment counters, but in this case
we need to return to the shell so we cannot call tst_brk() in the
helper. It's a very special situation here.
> Also we have TST_RES_SUPPORTS_TCONF_TDEBUG_TFAIL_TINFO_TPASS_TWARN check to not
> add TBROK to tst_res_().
That only works when the value is constant, if you pass via variable
that is not constant at build time you can pass whatever you want. Which
is another reason why it makes sense to relax the constraints.
> ...
> > - 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__);\
> })
See above.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list