All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Martin Doucha <mdoucha@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v4 3/4] tst_test.sh: Fix _tst_cleanup_timer() on set -e
Date: Wed, 10 Aug 2022 18:29:59 +0200	[thread overview]
Message-ID: <YvPdB6YhTlDAlPBR@pevik> (raw)
In-Reply-To: <7d501d57-2438-cd28-5e49-019ea06fb8f2@suse.cz>

Hi Martin,

> Hi,
> a comment explaining why this is needed would be nice, otherwise looks
> good. For patches 2 and 3:

> Reviewed-by: Martin Doucha <mdoucha@suse.cz>

> On 08. 08. 22 13:37, Petr Vorel wrote:
> > If test exits on time (i.e. no timeout) kill in _tst_cleanup_timer()
> > have nothing to kill therefore following wait exits 143.
I thought this is the explanation. Or would you prefer anything else to add?

Kind regards,
Petr

> > set -e (or #!/bin/sh -e or set -o errexit) quits on any non-zero exit code,
> > fix hardens _tst_cleanup_timer() to be able to be used on scripts with it.

> > Signed-off-by: Petr Vorel <pvorel@suse.cz>
> > ---
> > I can use 'if ...; then ; fi' if you prefer:

> > 	if [ "$LTP_COLORIZE_OUTPUT" = "n" -o "$LTP_COLORIZE_OUTPUT" = "0" ]; then
> > 		return 0
> > 	fi

> > 	if [ "$LTP_COLORIZE_OUTPUT" = "y" ] || [ "$LTP_COLORIZE_OUTPUT" = "1" ]; then
> > 		return 1
> > 	fi

> > ...
> > 	if [ "$color" = 1 ]; then
> > 		tst_flag2color "$1"
> > 	fi
> > 	printf "$2"
> > 	if [ "$color" = 1 ]; then
> > 		printf '\033[0m'
> > 	fi


> > Kind regards,
> > Petr

> >  testcases/lib/tst_test.sh | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)

> > diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
> > index 356af0106..1d2bf06cc 100644
> > --- a/testcases/lib/tst_test.sh
> > +++ b/testcases/lib/tst_test.sh
> > @@ -518,7 +518,7 @@ _tst_cleanup_timer()
> >  {
> >  	if [ -n "$_tst_setup_timer_pid" ]; then
> >  		kill -TERM $_tst_setup_timer_pid 2>/dev/null
> > -		wait $_tst_setup_timer_pid 2>/dev/null
> > +		wait $_tst_setup_timer_pid 2>/dev/null || true
> >  	fi
> >  }

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

  reply	other threads:[~2022-08-10 16:30 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-08 11:37 [LTP] [PATCH v4 0/4] set -e and bashism fixes Petr Vorel
2022-08-08 11:37 ` [LTP] [PATCH v4 1/4] tst_test.sh: runtest.sh: Remove unused code Petr Vorel
2022-08-09  9:25   ` Li Wang
2022-08-10 15:03   ` Martin Doucha
2022-08-08 11:37 ` [LTP] [PATCH v4 2/4] tst_ansi_color.sh: Allow to run with set -e Petr Vorel
2022-08-09  9:31   ` Li Wang
2022-08-09 12:04     ` Petr Vorel
2022-08-10  2:46       ` Li Wang
2022-08-10  6:36         ` Petr Vorel
2022-08-08 11:37 ` [LTP] [PATCH v4 3/4] tst_test.sh: Fix _tst_cleanup_timer() on " Petr Vorel
2022-08-09  9:35   ` Li Wang
2022-08-09 12:13     ` Petr Vorel
2022-08-10 15:08   ` Martin Doucha
2022-08-10 16:29     ` Petr Vorel [this message]
2022-08-11  8:00       ` Martin Doucha
2022-08-11  8:08         ` Petr Vorel
2022-08-11  8:35         ` Petr Vorel
2022-08-08 11:37 ` [LTP] [PATCH v4 4/4] generate_lvm_runfile.sh: Fix bashism Petr Vorel
2022-08-09 10:33   ` Li Wang
2022-08-10 15:13   ` Martin Doucha
2022-08-10 16:38     ` Petr Vorel

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=YvPdB6YhTlDAlPBR@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=mdoucha@suse.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.