[LTP] [PATCH 5/6] [WIP,RFC] tst_run.sh: Run setup() only once
Petr Vorel
pvorel@suse.cz
Fri Mar 13 15:25:59 CET 2026
Both C API and tst_test.sh shell API run test only once.
Fix shell loader API also to run setup only once.
This reuses functionality added in the previous commit.
Fixes: 8202494493 ("shell lib: Add basic support for test setup")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
NOTE: this is still not working on iterations (-i2), because
static int iterations is from tst_test.c is not propagated to
tst_run_shell.c. I wonder if I should set the value as environment
variable or add it into struct context.
testcases/lib/tst_run.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testcases/lib/tst_run.sh b/testcases/lib/tst_run.sh
index e876fd8946..b78c7be03a 100644
--- a/testcases/lib/tst_run.sh
+++ b/testcases/lib/tst_run.sh
@@ -15,7 +15,7 @@ fi
if [ -n "$TST_SETUP" ]; then
if command -v $TST_SETUP >/dev/null 2>/dev/null; then
- $TST_SETUP
+ [ "$1" != 1 ] || $TST_SETUP
else
tst_brk TBROK "TST_SETUP=$TST_SETUP declared, but function not defined (or cmd not found)"
fi
--
2.51.0
More information about the ltp
mailing list