From: Andrea Cervesato via ltp <ltp@lists.linux.it>
To: "Petr Vorel" <pvorel@suse.cz>, <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v2 2/2] tst_test.sh: Convert only TBROK/TCONF to TWARN in cleanup
Date: Thu, 18 Dec 2025 13:43:41 +0100 [thread overview]
Message-ID: <DF1CO0LSLWLZ.36NGISAN8GB9T@suse.com> (raw)
In-Reply-To: <20250211205734.1932275-2-pvorel@suse.cz>
Hi!
On Tue Feb 11, 2025 at 9:57 PM CET, Petr Vorel wrote:
> Second attempt to convert only TBROK/TCONF to TWARN in cleanup().
>
> Also print original message to help find function call with wrong
> parameter.
>
> Fixes: 55bfa08e17 ("tst_test.sh/tst_brk(): Convert only TBROK to TWARN in cleanup")
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> New in v2.
>
> testcases/lib/tst_test.sh | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
> index 5a6e34473f..0747f7aaf4 100644
> --- a/testcases/lib/tst_test.sh
> +++ b/testcases/lib/tst_test.sh
> @@ -126,11 +126,17 @@ tst_brk()
> local res=$1
> shift
>
> - if [ "$res" != TBROK -a "$res" != TCONF ]; then
> - tst_res TBROK "tst_brk can be called only with TBROK or TCONF ($res)"
> - elif [ "$TST_TBROK_TO_TWARN" = 1 ]; then
> - tst_res TWARN "$@"
> + if [ "$TST_TBROK_TO_TWARN" = 1 ]; then
> + if [ "$res" != TBROK -a "$res" != TCONF ]; then
> + tst_res TWARN "tst_brk can be called only with TBROK or TCONF ($res, msg: '$@')"
> + else
> + tst_res TWARN "$@"
> + fi
> return
> + fi
> +
> + if [ "$res" != TBROK -a "$res" != TCONF ]; then
> + tst_res TBROK "tst_brk can be called only with TBROK or TCONF ($res, msg: '$@')"
> else
> tst_res "$res" "$@"
> fi
Here there's a bit of code duplication. For instance, we can save the
message inside a variable, as well as the T-flag, the use it accordingly
to TST_TBROK_TO_TWARN.
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2025-12-18 12:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-11 20:57 [LTP] [PATCH v2 1/2] tst_test.sh: Fix TBROK => TWARN evaluation in tst_brk() Petr Vorel
2025-02-11 20:57 ` [LTP] [PATCH v2 2/2] tst_test.sh: Convert only TBROK/TCONF to TWARN in cleanup Petr Vorel
2025-12-18 12:43 ` Andrea Cervesato via ltp [this message]
2026-01-05 14:24 ` 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=DF1CO0LSLWLZ.36NGISAN8GB9T@suse.com \
--to=ltp@lists.linux.it \
--cc=andrea.cervesato@suse.com \
--cc=pvorel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox