From: Cyril Hrubis <chrubis@suse.cz>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [RFC PATCH 4/5] shell lib: Add basic support for test cleanup
Date: Fri, 7 Mar 2025 17:40:30 +0100 [thread overview]
Message-ID: <Z8shfrkfVkwsCOTw@yuki.lan> (raw)
In-Reply-To: <20250228172439.3276777-5-pvorel@suse.cz>
> diff --git a/testcases/lib/tst_env.sh b/testcases/lib/tst_env.sh
> index b13bab37c3..68f9a0daa9 100644
> --- a/testcases/lib/tst_env.sh
> +++ b/testcases/lib/tst_env.sh
> @@ -35,7 +35,3 @@ tst_brk_()
>
> alias tst_res="tst_res_ $tst_script_name \$LINENO"
> alias tst_brk="tst_brk_ $tst_script_name \$LINENO"
> -
> -if [ -n "$TST_CLEANUP" ]; then
> - trap $TST_CLEANUP EXIT
> -fi
> diff --git a/testcases/lib/tst_exec.sh b/testcases/lib/tst_exec.sh
> new file mode 100755
> index 0000000000..dcf40fd5bb
> --- /dev/null
> +++ b/testcases/lib/tst_exec.sh
> @@ -0,0 +1,19 @@
> +#!/bin/sh
> +# Copyright (c) 2025 Cyril Hrubis <chrubis@suse.cz>
> +# Copyright (c) 2025 Petr Vorel <pvorel@suse.cz>
> +
> +. tst_env.sh
> +
> +. "$1"
> +
> +if [ -n "$TST_CLEANUP" ]; then
> + trap $TST_CLEANUP EXIT
> +fi
> +
> +if [ -n "$TST_SETUP" ]; then
> + $TST_SETUP
> +fi
> +
> +tst_test
> +
> +# vim: set ft=sh ts=4 sts=4 sw=4 expandtab :
Please do not add the vim formatting hints.
> diff --git a/testcases/lib/tst_loader.sh b/testcases/lib/tst_loader.sh
> index 62c9cc6d8f..e2d1bd7daf 100644
> --- a/testcases/lib/tst_loader.sh
> +++ b/testcases/lib/tst_loader.sh
> @@ -3,11 +3,8 @@
> # Copyright (c) 2024-2025 Cyril Hrubis <chrubis@suse.cz>
> #
> # This is a loader for shell tests that use the C test library.
> -#
>
> if [ -z "$LTP_IPC_PATH" ]; then
> - tst_run_shell $(basename "$0") "$@"
> + tst_run_shell tst_exec.sh $(basename "$0") "$@"
> exit $?
> -else
> - . tst_env.sh
> fi
Do we really need the tst_exec.sh?
Doesn't it work if we add what is in the tst_exec here?
The whole point of [ -z "$LTP_IPC_PATH" ]; is to detect when we are
being re-executed by the tst_run_shell, so the else branch (which
isn't really needed, because we do exit in the if) was when the test did
run.
If you change the tests to be in functions and source the tst_loader.sh
at the end it should just work.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2025-03-07 16:40 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-28 17:24 [LTP] [RFC PATCH 0/5] shell loader rewrite to support TST_SETUP Petr Vorel
2025-02-28 17:24 ` [LTP] [RFC PATCH 1/5] shell lib: Add support for test cleanup Petr Vorel
2025-03-04 12:57 ` Li Wang
2025-03-04 13:08 ` Petr Vorel
2025-03-04 13:15 ` Li Wang
2025-02-28 17:24 ` [LTP] [RFC PATCH 2/5] lib: Allow test to have positional args Petr Vorel
2025-02-28 17:43 ` Petr Vorel
2025-03-07 16:17 ` Cyril Hrubis
2025-03-10 10:23 ` Petr Vorel
2025-03-07 16:27 ` Cyril Hrubis
2025-03-10 10:16 ` Petr Vorel
2025-02-28 17:24 ` [LTP] [RFC PATCH 3/5] shell: Move shell code into functions Petr Vorel
2025-02-28 17:45 ` Petr Vorel
2025-02-28 17:24 ` [LTP] [RFC PATCH 4/5] shell lib: Add basic support for test cleanup Petr Vorel
2025-03-07 16:40 ` Cyril Hrubis [this message]
2025-03-10 10:27 ` Petr Vorel
2025-04-25 18:33 ` Petr Vorel
2025-04-30 8:52 ` Cyril Hrubis
2025-04-30 8:57 ` Cyril Hrubis
2025-04-30 11:47 ` Petr Vorel
2025-04-30 13:39 ` Cyril Hrubis
2025-02-28 17:24 ` [LTP] [RFC PATCH 5/5] shell: Add shell_loader_setup_cleanup.sh test 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=Z8shfrkfVkwsCOTw@yuki.lan \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
--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