Linux Test Project
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v3 2/4] tst_ansi_color.sh: Allow to run with set -e
Date: Mon, 8 Aug 2022 13:12:13 +0200	[thread overview]
Message-ID: <YvDvjVU66LrHpZ2M@pevik> (raw)
In-Reply-To: <20220808101019.29892-3-pvorel@suse.cz>

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

> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/lib/tst_ansi_color.sh | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

> diff --git a/testcases/lib/tst_ansi_color.sh b/testcases/lib/tst_ansi_color.sh
> index 703df1eb8..4b2255448 100644
> --- a/testcases/lib/tst_ansi_color.sh
> +++ b/testcases/lib/tst_ansi_color.sh
> @@ -32,8 +32,9 @@ tst_color_enabled()

>  tst_print_colored()
>  {
> -	tst_color_enabled
> -	local color=$?
> +	local color=0
> +
> +	tst_color_enabled || color=$?
OK, this is not working for LTP_COLORIZE_OUTPUT=n => v4 will come shortly.

Kind regards,
Petr

>  	[ "$color" = "1" ] && tst_flag2color "$1"
>  	printf "$2"

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

  reply	other threads:[~2022-08-08 11:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-08 10:10 [LTP] [PATCH v3 0/4] set -e and bashism fixes Petr Vorel
2022-08-08 10:10 ` [LTP] [PATCH v3 1/4] tst_test.sh: runtest.sh: Remove unused code Petr Vorel
2022-08-08 10:10 ` [LTP] [PATCH v3 2/4] tst_ansi_color.sh: Allow to run with set -e Petr Vorel
2022-08-08 11:12   ` Petr Vorel [this message]
2022-08-08 10:10 ` [LTP] [PATCH v3 3/4] tst_test.sh: Fix _tst_cleanup_timer() on " Petr Vorel
2022-08-08 10:10 ` [LTP] [PATCH v3 4/4] generate_lvm_runfile.sh: Fix bashism 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=YvDvjVU66LrHpZ2M@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    /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