[LTP] [RFC PATCH 4/5] shell lib: Add basic support for test cleanup

Cyril Hrubis chrubis@suse.cz
Wed Apr 30 15:39:11 CEST 2025


Hi!
> > And one possible solution is to source the environment first and the
> > loader last, on the top of your shell-loader-setup-cleanup.v2 branch:
> 
> > diff --git a/testcases/lib/tests/shell_loader.sh b/testcases/lib/tests/shell_loader.sh
> > index eeed122c1..01acf6d35 100755
> > --- a/testcases/lib/tests/shell_loader.sh
> > +++ b/testcases/lib/tests/shell_loader.sh
> > @@ -14,6 +14,8 @@
> >  # }
> >  # ---
> 
> > +. tst_env.sh
> > +
> 
> OK, that is the missing piece, thank you!
> 
> i.e. sourcing tst_env.sh at the beginning before test function setup and
> tst_loader.sh at the end after test function setup). I thought we would avoid
> sourcing two files in the tests, that's why I haven't tried, but that's a minor
> detail. And it's better solution than having tst_exec.sh, which requires
> tst_run_shell.c modification, just to do the same thing (source tst_env.sh).

Given all the choices I too think that soucing tst_env.sh first to get
all the defitions and tst_loader.sh to start the test is the cleanest
solution.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list