[LTP] [PATCH v3] tst_taint: print readable error message instead of numerical codes

Petr Vorel pvorel@suse.cz
Fri Jan 21 07:19:48 CET 2022


Hi Kusal,

...
> >  	if ((taint & taint_mask) != 0)
> > -		tst_brk(TBROK, "Kernel is already tainted: %u", taint);
> > +		for (i = 0; i < ARRAY_SIZE(taint_strings); i++)
> > +			if (taint & (1 << i))
> > +				tst_brk(TBROK, "Kernel is already tainted: %s",
> > +					taint_strings[i]);
> The main reason why I just didn't fix the whitespace myself and applied is using
> tst_brk(). It quits test on first matching flag. You can accumulate letters into
> char array and print after loop.

I'm sorry, actually not a char array - I forgot we don't print just the letter,
but string (letter with a description).
You could accumulate string with strcat and print it at the end.
But maybe just use tst_res(TINFO, ...) to print the flag in the loop
and in the end tst_brk(TBROK, "Kernel is already tainted").

Kind regards,
Petr


More information about the ltp mailing list