tst_test.sh: Use 'command -v' instead of 'which'
PATCH 1/1 tst_test.sh: Use 'command -v' instead of 'which'
to avoid unnecessary dependency.
'which' is a binary file, which might not be installed (common on containers). 'command' is a shell builtin, available everywhere, we already use non-standard -v option commonly supported (bash, dash, busybox ash).
Fixes 7783ac3a0 ("lib/tst_test.sh: Add new shell library")
Signed-off-by Petr Vorel <[email protected]>
--- testcases/lib/tst_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/lib/tst_test.sh +1 -1
@@ -685,7 +685,7 @@ else fi if [ -z "$TST_NO_DEFAULT_RUN" ]; then - if TST_TEST_PATH=$(which $0) 2>/dev/null; then + if TST_TEST_PATH=$(command -v $0) 2>/dev/null; then if ! grep -q tst_run "$TST_TEST_PATH"; then tst_brk TBROK "Test $0 must call tst_run!" fi
Signature · 1 line
2.31.1
PATCH 1/1 tst_test.sh: Use 'command -v' instead of 'which'
Reviewed-by Cyril Hrubis <[email protected]>
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 tst_test.sh: Use 'command -v' instead of 'which'
Hi Cyril,
Thanks for your review, merged!
Kind regards,
Petr