From 2edf61f31502f2c59f1735cd56ca85fd8a174a3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sat, 29 Jan 2022 01:59:52 +0100 Subject: [PATCH] ZTS: explicitly strip whitespace for broken wc(1) implementations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Reviewed-by: Ryan Moeller Signed-off-by: Ahelenia ZiemiaƄska Closes #13032 --- .../tests/functional/alloc_class/alloc_class_012_pos.ksh | 1 + .../functional/cli_root/zpool_events/zpool_events_clear.ksh | 1 + .../zfs-tests/tests/functional/mv_files/mv_files_common.kshlib | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/zfs-tests/tests/functional/alloc_class/alloc_class_012_pos.ksh b/tests/zfs-tests/tests/functional/alloc_class/alloc_class_012_pos.ksh index efb6c4754689..0b1c18bafdaf 100755 --- a/tests/zfs-tests/tests/functional/alloc_class/alloc_class_012_pos.ksh +++ b/tests/zfs-tests/tests/functional/alloc_class/alloc_class_012_pos.ksh @@ -34,6 +34,7 @@ function file_in_special_vdev # typeset dataset="$1" typeset inum="$2" typeset num_normal=$(echo $ZPOOL_DISKS | wc -w) + num_normal=${num_normal##* } zdb -dddddd $dataset $inum | awk -v d=$num_normal '{ # find DVAs from string "offset level dva" only for L0 (data) blocks diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_clear.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_clear.ksh index fe55591489ec..1df8ff441623 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_clear.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_clear.ksh @@ -44,6 +44,7 @@ done # wait a bit to allow the kernel module to process new events zpool_events_settle EVENTS_NUM=$(zpool events -H | wc -l) +EVENTS_NUM=${EVENTS_NUM##* } # 3. Verify 'zpool events -c' successfully clear new events CLEAR_OUTPUT=$(zpool events -c) diff --git a/tests/zfs-tests/tests/functional/mv_files/mv_files_common.kshlib b/tests/zfs-tests/tests/functional/mv_files/mv_files_common.kshlib index 4794d8ae94b6..3ddd8f113a3b 100644 --- a/tests/zfs-tests/tests/functional/mv_files/mv_files_common.kshlib +++ b/tests/zfs-tests/tests/functional/mv_files/mv_files_common.kshlib @@ -115,7 +115,7 @@ function mv_files function count_files { typeset -i file_num - file_num=$(find $1 -type f -print | wc -l) + file_num=$(find $1 -type f -print | wc -l | tr -d ' ') (( file_num != $2 )) && \ log_fail "The file number of target directory"\ "$2 is not equal to that of the source "\