[LTP] [PATCH v2 0/4] shell loader rewrite to support TST_SETUP

Petr Vorel pvorel@suse.cz
Wed Apr 30 15:04:13 CEST 2025


Hi Cyril, all,

we are getting there, but not yet finished.

one remaining problem - it requires *full* path in PATH. I wonder what
basic I'm missing.  The current change requires to use full path
otherwise execvpe() fails.

I suppose it is due change cwd due creating temporary directory - it
fails only with:
"needs_tmpdir": true
shell_loader_setup_cleanup.sh does not suffer this problem.
It's also not dash related, problem is on bash as well.

# PATH="testcases/lib:testcases/lib/tests:$PATH" shell_loader.sh
tst_tmpdir.c:316: TINFO: Using /tmp/LTP_sheQVjoS6 as tmpdir (tmpfs filesystem)
tst_test.c:1903: TINFO: LTP version: 20250130-250-g344e47016d
...
tst_test.c:1720: TINFO: Overall timeout per run is 0h 00m 30s
tst_test.c:218: TBROK: execvpe(shell_loader.sh, ...) failed!: ENOENT (2)

NOTE: export PATH does not help.

# export PATH="testcases/lib:testcases/lib/tests:$PATH"
# shell_loader.sh
tst_tmpdir.c:316: TINFO: Using /tmp/LTP_sheQVjoS6 as tmpdir (tmpfs filesystem)
tst_test.c:1903: TINFO: LTP version: 20250130-250-g344e47016d
...
tst_test.c:1720: TINFO: Overall timeout per run is 0h 00m 30s
tst_test.c:218: TBROK: execvpe(shell_loader.sh, ...) failed!: ENOENT (2)

Full path helps:

# PATH="/opt/ltp/testcases/bin:$PATH" shell_loader.sh
tst_tmpdir.c:316: TINFO: Using /tmp/LTP_shejdXdvf as tmpdir (tmpfs filesystem)
tst_test.c:1903: TINFO: LTP version: 20250130-250-g344e47016d
...
tst_test.c:1720: TINFO: Overall timeout per run is 0h 00m 30s
shell_loader.sh:-1: TPASS: Shell loader works fine!
shell_loader.sh:-1: TPASS: We are running in temp directory in /tmp/LTP_shejdXdvf

And yes, we have -1 on dash, but as you noted in tst_env.sh we can do
nothing about it.

Changes v1->v2:
* use tst_env.sh also in tests instead using tst_exec.sh in
  tst_run_shell.c. Therefore remove "lib: Allow test to have positional
  args" commit.

Link to v1:
https://patchwork.ozlabs.org/project/ltp/list/?series=446566&state=*
https://lore.kernel.org/ltp/20250228172439.3276777-1-pvorel@suse.cz/

Cyril Hrubis (1):
  shell lib: Add support for test cleanup

Petr Vorel (3):
  shell: Move shell code into functions
  shell lib: Add basic support for test setup
  shell: Add shell_loader_setup_cleanup.sh test

 testcases/kernel/mem/vma/vma05.sh             | 47 ++++++++++---------
 testcases/lib/run_tests.sh                    |  5 +-
 testcases/lib/tests/shell_loader.sh           | 21 +++++----
 .../lib/tests/shell_loader_all_filesystems.sh | 28 ++++++-----
 .../lib/tests/shell_loader_brk_cleanup.sh     | 25 ++++++++++
 testcases/lib/tests/shell_loader_c_child.sh   | 17 ++++---
 testcases/lib/tests/shell_loader_cleanup.sh   | 25 ++++++++++
 .../lib/tests/shell_loader_filesystems.sh     | 25 ++++++----
 .../lib/tests/shell_loader_invalid_block.sh   |  9 +++-
 .../tests/shell_loader_invalid_metadata.sh    |  9 +++-
 testcases/lib/tests/shell_loader_kconfigs.sh  |  9 +++-
 .../lib/tests/shell_loader_no_metadata.sh     |  9 +++-
 .../lib/tests/shell_loader_setup_cleanup.sh   | 31 ++++++++++++
 .../lib/tests/shell_loader_supported_archs.sh |  9 +++-
 testcases/lib/tests/shell_loader_tags.sh      |  9 +++-
 testcases/lib/tests/shell_loader_tcnt.sh      |  9 +++-
 .../lib/tests/shell_loader_wrong_metadata.sh  |  9 +++-
 testcases/lib/tst_env.sh                      |  5 --
 testcases/lib/tst_loader.sh                   | 15 ++++--
 19 files changed, 235 insertions(+), 81 deletions(-)
 create mode 100755 testcases/lib/tests/shell_loader_brk_cleanup.sh
 create mode 100755 testcases/lib/tests/shell_loader_cleanup.sh
 create mode 100755 testcases/lib/tests/shell_loader_setup_cleanup.sh

-- 
2.49.0



More information about the ltp mailing list