From: Ross Burton Date: Tue, 29 Jun 2021 15:34:20 +0000 (+0100) Subject: tests: don't hardcode /bin/kill in the kill tests X-Git-Tag: v2.37.1~31 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=0be381be442e67346f0007b04af904ab01720c8f;p=thirdparty%2Futil-linux.git tests: don't hardcode /bin/kill in the kill tests 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 --- diff --git a/tests/ts/kill/all_processes b/tests/ts/kill/all_processes index 0b137574d7..b2280777fc 100755 --- a/tests/ts/kill/all_processes +++ b/tests/ts/kill/all_processes @@ -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" diff --git a/tests/ts/kill/name_to_number b/tests/ts/kill/name_to_number index 9f4881cb71..8a7f4bef05 100755 --- a/tests/ts/kill/name_to_number +++ b/tests/ts/kill/name_to_number @@ -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" diff --git a/tests/ts/kill/options b/tests/ts/kill/options index 2788c70a27..10653a543b 100755 --- a/tests/ts/kill/options +++ b/tests/ts/kill/options @@ -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" diff --git a/tests/ts/kill/print_pid b/tests/ts/kill/print_pid index 6926a3714b..6e2db3711f 100755 --- a/tests/ts/kill/print_pid +++ b/tests/ts/kill/print_pid @@ -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" diff --git a/tests/ts/kill/queue b/tests/ts/kill/queue index 18f10e8c29..6c9e9efc9b 100755 --- a/tests/ts/kill/queue +++ b/tests/ts/kill/queue @@ -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"