Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH v1] tst_taint: Print readable error message instead of numerical code
@ 2022-01-11 15:00 Kushal Chand
  2022-01-12 15:18 ` Petr Vorel
  0 siblings, 1 reply; 4+ messages in thread
From: Kushal Chand @ 2022-01-11 15:00 UTC (permalink / raw)
  To: ltp; +Cc: Kushal Chand

---
 lib/tst_taint.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/tst_taint.c b/lib/tst_taint.c
index 49146aacb..af94656ed 100644
--- a/lib/tst_taint.c
+++ b/lib/tst_taint.c
@@ -90,7 +90,7 @@ void tst_taint_init(unsigned int mask)
 	}
 
 	if ((taint & taint_mask) != 0)
-		tst_brk(TBROK, "Kernel is already tainted: %u", taint);
+		tst_brk(TBROK, "Kernel is already tainted: TAINT_D (OOPS)");
 }
 
 
-- 
2.25.1



-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH v1] tst_taint: Print readable error message instead of numerical code
  2022-01-11 15:00 [LTP] [PATCH v1] tst_taint: Print readable error message instead of numerical code Kushal Chand
@ 2022-01-12 15:18 ` Petr Vorel
  2022-01-13  4:09   ` Kushal Chand
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2022-01-12 15:18 UTC (permalink / raw)
  To: Kushal Chand; +Cc: ltp

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH v1] tst_taint: Print readable error message instead of numerical code
  2022-01-12 15:18 ` Petr Vorel
@ 2022-01-13  4:09   ` Kushal Chand
  2022-01-14 12:09     ` Petr Vorel
  0 siblings, 1 reply; 4+ messages in thread
From: Kushal Chand @ 2022-01-13  4:09 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp


[-- Attachment #1.1: Type: text/plain, Size: 929 bytes --]

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? 


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

[-- Attachment #1.2: Type: text/html, Size: 1816 bytes --]

[-- Attachment #2: Type: text/plain, Size: 60 bytes --]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH v1] tst_taint: Print readable error message instead of numerical code
  2022-01-13  4:09   ` Kushal Chand
@ 2022-01-14 12:09     ` Petr Vorel
  0 siblings, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2022-01-14 12:09 UTC (permalink / raw)
  To: Kushal Chand; +Cc: ltp

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-01-14 12:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-11 15:00 [LTP] [PATCH v1] tst_taint: Print readable error message instead of numerical code Kushal Chand
2022-01-12 15:18 ` Petr Vorel
2022-01-13  4:09   ` Kushal Chand
2022-01-14 12:09     ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox