ZTS: explicitly strip whitespace for broken wc(1) implementations

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13032
This commit is contained in:
наб 2022-01-29 01:59:52 +01:00 committed by GitHub
parent 7633c0aedd
commit 73e972af7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 1 deletions

View File

@ -34,6 +34,7 @@ function file_in_special_vdev # <dataset> <inode>
typeset dataset="$1" typeset dataset="$1"
typeset inum="$2" typeset inum="$2"
typeset num_normal=$(echo $ZPOOL_DISKS | wc -w) typeset num_normal=$(echo $ZPOOL_DISKS | wc -w)
num_normal=${num_normal##* }
zdb -dddddd $dataset $inum | awk -v d=$num_normal '{ zdb -dddddd $dataset $inum | awk -v d=$num_normal '{
# find DVAs from string "offset level dva" only for L0 (data) blocks # find DVAs from string "offset level dva" only for L0 (data) blocks

View File

@ -44,6 +44,7 @@ done
# wait a bit to allow the kernel module to process new events # wait a bit to allow the kernel module to process new events
zpool_events_settle zpool_events_settle
EVENTS_NUM=$(zpool events -H | wc -l) EVENTS_NUM=$(zpool events -H | wc -l)
EVENTS_NUM=${EVENTS_NUM##* }
# 3. Verify 'zpool events -c' successfully clear new events # 3. Verify 'zpool events -c' successfully clear new events
CLEAR_OUTPUT=$(zpool events -c) CLEAR_OUTPUT=$(zpool events -c)

View File

@ -115,7 +115,7 @@ function mv_files
function count_files function count_files
{ {
typeset -i file_num 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 )) && \ (( file_num != $2 )) && \
log_fail "The file number of target directory"\ log_fail "The file number of target directory"\
"$2 is not equal to that of the source "\ "$2 is not equal to that of the source "\