From 592cf7f1e23280ab3f02b649fdcda75b72d16729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Wed, 9 Mar 2022 13:52:14 +0100 Subject: [PATCH] tests: get rid of which MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Reviewed-by: John Kennedy Reviewed-by: Ryan Moeller Signed-off-by: Ahelenia ZiemiaƄska Closes #13259 --- tests/zfs-tests/include/commands.cfg | 3 +-- tests/zfs-tests/include/libtest.shlib | 2 +- tests/zfs-tests/tests/functional/mmap/mmap_libaio_001_pos.ksh | 4 +--- tests/zfs-tests/tests/functional/pam/setup.ksh | 4 +--- .../tests/functional/user_namespace/user_namespace_001.ksh | 4 ++-- 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/tests/zfs-tests/include/commands.cfg b/tests/zfs-tests/include/commands.cfg index 50449633ac..a5ee92071b 100644 --- a/tests/zfs-tests/include/commands.cfg +++ b/tests/zfs-tests/include/commands.cfg @@ -109,8 +109,7 @@ export SYSTEM_FILES_COMMON='arp uuidgen vmstat wait - wc - which' + wc' export SYSTEM_FILES_FREEBSD='chflags compress diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib index a78c10ce2e..f786f05e8a 100644 --- a/tests/zfs-tests/include/libtest.shlib +++ b/tests/zfs-tests/include/libtest.shlib @@ -2618,7 +2618,7 @@ function add_user_linux # # Add new users to the same group and the command line utils. # This allows them to be run out of the original users home # directory as long as it permissioned to be group readable. - cmd_group=$(stat --format="%G" $(which zfs)) + cmd_group=$(stat --format="%G" $(command -v zfs)) log_must usermod -a -G $cmd_group $user return 0 diff --git a/tests/zfs-tests/tests/functional/mmap/mmap_libaio_001_pos.ksh b/tests/zfs-tests/tests/functional/mmap/mmap_libaio_001_pos.ksh index 36a7e76f9f..031d90c383 100755 --- a/tests/zfs-tests/tests/functional/mmap/mmap_libaio_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/mmap/mmap_libaio_001_pos.ksh @@ -42,9 +42,7 @@ verify_runnable "global" log_assert "verify mmap'd pages work with libaio" # mmap_libaio is built when the libaio-devel package is installed. -if ! which mmap_libaio; then - log_unsupported "This test requires mmap_libaio." -fi +command -v mmap_libaio > /dev/null || log_unsupported "This test requires mmap_libaio." log_must chmod 777 $TESTDIR diff --git a/tests/zfs-tests/tests/functional/pam/setup.ksh b/tests/zfs-tests/tests/functional/pam/setup.ksh index 23515a598e..8ef9fbe0fe 100755 --- a/tests/zfs-tests/tests/functional/pam/setup.ksh +++ b/tests/zfs-tests/tests/functional/pam/setup.ksh @@ -22,9 +22,7 @@ . $STF_SUITE/tests/functional/pam/utilities.kshlib -if ! which pamtester; then - log_unsupported "pam tests require the pamtester utility to be installed" -fi +command -v pamtester > /dev/null || log_unsupported "pam tests require the pamtester utility to be installed" DISK=${DISKS%% *} create_pool $TESTPOOL "$DISK" diff --git a/tests/zfs-tests/tests/functional/user_namespace/user_namespace_001.ksh b/tests/zfs-tests/tests/functional/user_namespace/user_namespace_001.ksh index 6be30ab4d2..3d19c4273e 100755 --- a/tests/zfs-tests/tests/functional/user_namespace/user_namespace_001.ksh +++ b/tests/zfs-tests/tests/functional/user_namespace/user_namespace_001.ksh @@ -51,8 +51,8 @@ log_onexit cleanup log_assert "Check root in user namespaces" -TOUCH=$(readlink -e $(which touch)) -CHMOD=$(readlink -e $(which chmod)) +TOUCH=$(readlink -f $(command -v touch)) +CHMOD=$(readlink -f $(command -v chmod)) for i in ${files[*]}; do log_must $TOUCH $TESTDIR/$i