]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: don't hardcode /bin/kill in the kill tests
authorRoss Burton <ross.burton@arm.com>
Tue, 29 Jun 2021 15:34:20 +0000 (16:34 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 20 Jul 2021 09:52:16 +0000 (11:52 +0200)
If the 'kill' test is executed with --use-system-commands, it calls
/bin/kill to avoid the shell's own kill command being invoked.

However, this doesn't work if the kill we want to test isn't in fact in
/bin.  Instead, use $(which kill) to find a kill on the PATH and call
that directly.

Signed-off-by: Ross Burton <ross.burton@arm.com>
tests/ts/kill/all_processes
tests/ts/kill/name_to_number
tests/ts/kill/options
tests/ts/kill/print_pid
tests/ts/kill/queue

index 0b137574d72f4d2c2053f1d5f01d6eecd0dde7db..b2280777fca6f2eaa09905a43d78fb47a20418ec 100755 (executable)
@@ -22,7 +22,7 @@ ts_skip_nonroot
 
 # make sure we do not use shell built-in command
 if [ "$TS_USE_SYSTEM_COMMANDS" == "yes" ]; then
-       TS_CMD_KILL="/bin/kill"
+       TS_CMD_KILL="$(which kill)"
 fi
 
 ts_check_test_command "$TS_CMD_KILL"
index 9f4881cb71c0d514b8039a750c40624ca5a0cf62..8a7f4bef055681bdccf2d54b99cf0fabb8c499ff 100755 (executable)
@@ -20,7 +20,7 @@ ts_init "$*"
 
 # make sure we do not use shell built-in command
 if [ "$TS_USE_SYSTEM_COMMANDS" == "yes" ]; then
-       TS_CMD_KILL="/bin/kill"
+       TS_CMD_KILL="$(which kill)"
 fi
 
 ts_check_test_command "$TS_CMD_KILL"
index 2788c70a27dcbc84a4d7f8c62edf479c6f915f03..10653a543bd9a5a1ee3aec43035397e34ab6d87e 100755 (executable)
@@ -20,7 +20,7 @@ ts_init "$*"
 
 # make sure we do not use shell built-in command
 if [ "$TS_USE_SYSTEM_COMMANDS" == "yes" ]; then
-       TS_CMD_KILL="/bin/kill"
+       TS_CMD_KILL="$(which kill)"
 fi
 
 ts_check_test_command "$TS_CMD_KILL"
index 6926a3714b0dcf13a1a32f3e5d8739fcc4ba6e1e..6e2db3711f64d16342a115a63df27079b34e961c 100755 (executable)
@@ -20,7 +20,7 @@ ts_init "$*"
 
 # make sure we do not use shell built-in command
 if [ "$TS_USE_SYSTEM_COMMANDS" == "yes" ]; then
-       TS_CMD_KILL="/bin/kill"
+       TS_CMD_KILL="$(which kill)"
 fi
 
 ts_check_test_command "$TS_CMD_KILL"
index 18f10e8c2952678f088abf8a2859e6e08a90eb57..6c9e9efc9b0bd5c877f5e78822112ce2ed7d5be4 100755 (executable)
@@ -20,7 +20,7 @@ ts_init "$*"
 
 # make sure we do not use shell built-in command
 if [ "$TS_USE_SYSTEM_COMMANDS" == "yes" ]; then
-       TS_CMD_KILL="/bin/kill"
+       TS_CMD_KILL="$(which kill)"
 fi
 
 ts_check_test_command "$TS_CMD_KILL"