public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Kushal Chand <kushalkataria5@gmail.com>,
	Martin Doucha <martin.doucha@suse.com>,
	ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v3] tst_taint: print readable error message instead of numerical codes
Date: Fri, 21 Jan 2022 07:19:48 +0100	[thread overview]
Message-ID: <YepQhE/lpb2sGR0B@pevik> (raw)
In-Reply-To: <YenCsGyklP6fAxz2@pevik>

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

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

      reply	other threads:[~2022-01-21  6:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-20 16:34 [LTP] [PATCH v3] tst_taint: print readable error message instead of numerical codes Kushal Chand
2022-01-20 20:14 ` Petr Vorel
2022-01-21  6:19   ` Petr Vorel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YepQhE/lpb2sGR0B@pevik \
    --to=pvorel@suse.cz \
    --cc=kushalkataria5@gmail.com \
    --cc=ltp@lists.linux.it \
    --cc=martin.doucha@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox