* [LTP] [PATCH 1/1] tst_test.sh: Use 'command -v' instead of 'which'
@ 2021-04-16 17:22 Petr Vorel
2021-04-19 13:34 ` Cyril Hrubis
0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2021-04-16 17:22 UTC (permalink / raw)
To: ltp
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 <pvorel@suse.cz>
---
testcases/lib/tst_test.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index 7f98e06bf..95ece42f6 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -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
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [LTP] [PATCH 1/1] tst_test.sh: Use 'command -v' instead of 'which'
2021-04-16 17:22 [LTP] [PATCH 1/1] tst_test.sh: Use 'command -v' instead of 'which' Petr Vorel
@ 2021-04-19 13:34 ` Cyril Hrubis
2021-04-20 6:37 ` Petr Vorel
0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2021-04-19 13:34 UTC (permalink / raw)
To: ltp
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 3+ messages in thread
* [LTP] [PATCH 1/1] tst_test.sh: Use 'command -v' instead of 'which'
2021-04-19 13:34 ` Cyril Hrubis
@ 2021-04-20 6:37 ` Petr Vorel
0 siblings, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2021-04-20 6:37 UTC (permalink / raw)
To: ltp
Hi Cyril,
Thanks for your review, merged!
Kind regards,
Petr
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-20 6:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16 17:22 [LTP] [PATCH 1/1] tst_test.sh: Use 'command -v' instead of 'which' Petr Vorel
2021-04-19 13:34 ` Cyril Hrubis
2021-04-20 6:37 ` Petr Vorel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.