[LTP] [PATCH v1] tst_taint: Print readable error message instead of numerical code

Petr Vorel pvorel@suse.cz
Fri Jan 14 13:09:46 CET 2022


Hi Kushal,

> Hi Petr,

> I am really sorry I forgot to mention the link to issue on LTP for which I have submitted the patch. 

> Can you please check https://github.com/linux-test-project/ltp/issues/776 if you have not already? 

Thanks, I was not aware of this. Thank you for working on this.
Please next time add flag to git commit message:

if it's an implementation:
Implements: #776

or if it's a fix:
Fixes: #776

Cyril wanted to transform numeric value to string name - there are various taint
flags, but we print flag as number. Could you please have look at const char
*tst_strerrno(int err) in lib/errnos.h and wrote similar function for this?
i.e.:

-		tst_brk(TBROK, "Kernel is already tainted: %u", taint);
+		tst_brk(TBROK, "Kernel is already tainted: %u", tst_strtaint(taint));

const char *tst_strtaint(int err)
{
    static const struct pair taint_pairs[] = {
		STRPAIR(TST_TAINT_A, "A (ACPI table has been overwritten)")
		STRPAIR(TST_TAINT_B, "B (page-release function found bad page)")
		...
	};

    PAIR_LOOKUP(errno_pairs, err);
}

Maybe Cyril has additional comments how the string should look like.

Kind regards,
Petr


> I just followed what the issue points out. 

> If not I will follow what you have mentioned if given more references to tst_strerrno()






> ---- On Wed, 12 Jan 2022 20:48:50 +0530 Petr Vorel <pvorel@suse.cz> wrote ----



> Hi Kushal, 

> >      if ((taint & taint_mask) != 0) 
> > -        tst_brk(TBROK, "Kernel is already tainted: %u", taint); 
> > +        tst_brk(TBROK, "Kernel is already tainted: TAINT_D (OOPS)"); 

> Kernel can be tainted before testing with different flags than D. 

> If you don't like the number, how about create function to map taint flag to 
> char? i.e. similarly to tst_strerrno()? 

> Kind regards, 
> Petr 






> Regards,
> Kushal


More information about the ltp mailing list