[LTP] [PATCH v4 3/4] tst_test.sh: Fix _tst_cleanup_timer() on set -e

Li Wang liwang@redhat.com
Tue Aug 9 11:35:30 CEST 2022


On Mon, Aug 8, 2022 at 7:39 PM Petr Vorel <pvorel@suse.cz> wrote:

> If test exits on time (i.e. no timeout) kill in _tst_cleanup_timer()
> have nothing to kill therefore following wait exits 143.
>
> 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
>

These ^ clarifications should be added in patch 2/4, right?

Anyway, this one looks good.
Reviewed-by: Li Wang <liwang@redhat.com>


-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20220809/20e3be31/attachment.htm>


More information about the ltp mailing list