mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-25 03:37:45 +03:00
tests: nawk -> awk
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: John Kennedy <john.kennedy@delphix.com> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #13259
This commit is contained in:
@@ -58,7 +58,7 @@ function get_acl #<obj>
|
||||
return 1
|
||||
fi
|
||||
|
||||
ls -vd $obj | nawk '(NR != 1) {print $0}'
|
||||
ls -vd $obj | awk '(NR != 1) {print $0}'
|
||||
}
|
||||
|
||||
#
|
||||
@@ -73,7 +73,7 @@ function get_compact_acl #<obj>
|
||||
return 1
|
||||
fi
|
||||
|
||||
ls -Vd $obj | nawk '(NR != 1) {print $0}'
|
||||
ls -Vd $obj | awk '(NR != 1) {print $0}'
|
||||
}
|
||||
|
||||
#
|
||||
@@ -246,7 +246,7 @@ function count_ACE #<file or dir name>
|
||||
return 1
|
||||
fi
|
||||
|
||||
ls -vd $1 | nawk 'BEGIN {count=0}
|
||||
ls -vd $1 | awk 'BEGIN {count=0}
|
||||
(NR != 1)&&(/[0-9]:/) {count++}
|
||||
END {print count}'
|
||||
|
||||
|
||||
@@ -52,8 +52,7 @@ do
|
||||
log_must zpool create $TESTPOOL $type $ZPOOL_DISKS \
|
||||
special $stype $sdisks
|
||||
|
||||
ac_value="$(zpool get -H -o property,value all | \
|
||||
egrep allocation_classes | nawk '{print $2}')"
|
||||
ac_value="$(zpool get -H -o property,value all | awk '/allocation_classes/ {print $2}')"
|
||||
if [ "$ac_value" = "active" ]; then
|
||||
log_note "feature@allocation_classes is active"
|
||||
else
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ function verify_cache_device
|
||||
#
|
||||
# mirror:/disks/d ONLINE mirror:/disks/e ONLINE stripe:/disks/f ONLINE
|
||||
#
|
||||
set -A dev_stat_tab $(zpool status -v $pool | nawk 'BEGIN {start=0} \
|
||||
set -A dev_stat_tab $(zpool status -v $pool | awk 'BEGIN {start=0} \
|
||||
/\tcache/ {start=1}
|
||||
/\tmirror/ || /\tspares/ || /^$/ {start=0}
|
||||
(start==1) && /\t (\/|[a-zA-Z])/ \
|
||||
|
||||
@@ -33,5 +33,5 @@ export CPATH1=$TEST_BASE_DIR/cachefile.1.$$
|
||||
export CPATH2=$TEST_BASE_DIR/cachefile.2.$$
|
||||
|
||||
export DISKSARRAY=$DISKS
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
|
||||
set_device_dir
|
||||
|
||||
@@ -76,10 +76,10 @@ function verify_size_estimates
|
||||
typeset file_size=$2
|
||||
typeset refer_diff=$(echo "$refer_size - $estimate_size" | bc)
|
||||
refer_diff=$(echo "$refer_diff / 1" | bc)
|
||||
refer_diff=$(echo "$refer_diff" | nawk '{print ($1 < 0) ? ($1 * -1): $1'})
|
||||
refer_diff=$(echo "$refer_diff" | awk '{print ($1 < 0) ? ($1 * -1): $1'})
|
||||
typeset file_diff=$(echo "$file_size - $estimate_size" | bc)
|
||||
file_diff=$(echo "$file_diff / 1" | bc)
|
||||
file_diff=$(echo "$file_diff" | nawk '{print ($1 < 0) ? ($1 * -1):$1'})
|
||||
file_diff=$(echo "$file_diff" | awk '{print ($1 < 0) ? ($1 * -1):$1'})
|
||||
typeset expected_diff=$(cal_percentage $refer_size)
|
||||
|
||||
[[ -z $refer_diff && -z $file_diff && -z $expected_diff ]] && \
|
||||
|
||||
@@ -86,9 +86,9 @@ done
|
||||
log_note "verify multiple snapshot transaction group"
|
||||
txg_group=$(zdb -Pd $TESTPOOL | awk '/snap/ {print $7}')
|
||||
for i in 1 2 3; do
|
||||
txg_tag=$(echo "$txg_group" | nawk -v j=$i 'FNR == j {print}')
|
||||
txg_tag=$(echo "$txg_group" | awk -v j=$i 'FNR == j {print}')
|
||||
[[ $txg_tag != $(echo "$txg_group" | \
|
||||
nawk -v j=$i 'FNR == j {print}') ]] \
|
||||
awk -v j=$i 'FNR == j {print}') ]] \
|
||||
&& log_fail "snapshots belong to different transaction groups"
|
||||
done
|
||||
log_note "verify snapshot contents"
|
||||
|
||||
@@ -71,7 +71,7 @@ typeset expect_str2="All filesystems are formatted with the current version"
|
||||
typeset expect_str3="The following filesystems are out of date, and can be upgraded"
|
||||
typeset -i COUNT OLDCOUNT
|
||||
|
||||
zfs upgrade | nawk '$1 ~ "^[0-9]+$" {print $2}'> $oldoutput
|
||||
zfs upgrade | awk '$1 ~ "^[0-9]+$" {print $2}'> $oldoutput
|
||||
OLDCOUNT=$(wc -l < $oldoutput)
|
||||
|
||||
old_datasets=""
|
||||
@@ -98,8 +98,8 @@ log_must eval 'zfs upgrade > $output 2>&1'
|
||||
|
||||
# we also check that the usage message contains at least a description
|
||||
# of the current ZFS version.
|
||||
log_must eval 'grep "${expect_str1} $ZFS_VERSION" $output > /dev/null 2>&1'
|
||||
zfs upgrade | nawk '$1 ~ "^[0-9]+$" {print $2}'> $output
|
||||
log_must grep -q "${expect_str1} $ZFS_VERSION" $output
|
||||
zfs upgrade | awk '$1 ~ "^[0-9]+$" {print $2}'> $output
|
||||
COUNT=$(wc -l < $output)
|
||||
|
||||
typeset -i i=0
|
||||
@@ -118,13 +118,13 @@ for fs in $old_datasets ; do
|
||||
done
|
||||
|
||||
log_must eval 'zfs upgrade > $output 2>&1'
|
||||
log_must eval 'grep "${expect_str1} $ZFS_VERSION" $output > /dev/null 2>&1'
|
||||
log_must grep -q "${expect_str1} $ZFS_VERSION" $output
|
||||
if (( OLDCOUNT == 0 )); then
|
||||
log_must eval 'grep "${expect_str2}" $output > /dev/null 2>&1'
|
||||
log_must grep -q "${expect_str2}" $output
|
||||
else
|
||||
log_must eval 'grep "${expect_str3}" $output > /dev/null 2>&1'
|
||||
log_must grep -q "${expect_str3}" $output
|
||||
fi
|
||||
zfs upgrade | nawk '$1 ~ "^[0-9]+$" {print $2}'> $output
|
||||
zfs upgrade | awk '$1 ~ "^[0-9]+$" {print $2}'> $output
|
||||
COUNT=$(wc -l < $output)
|
||||
|
||||
if (( COUNT != OLDCOUNT )); then
|
||||
|
||||
@@ -60,8 +60,8 @@ typeset expect_str2="Enhanced directory entries"
|
||||
|
||||
log_must eval 'zfs upgrade -v > /dev/null 2>&1'
|
||||
|
||||
zfs upgrade -v | nawk '$1 ~ "^[0-9]+$" {print $0}'> $output
|
||||
log_must eval 'grep "${expect_str1}" $output > /dev/null 2>&1'
|
||||
log_must eval 'grep "${expect_str2}" $output > /dev/null 2>&1'
|
||||
zfs upgrade -v | awk '$1 ~ "^[0-9]+$" {print $0}'> $output
|
||||
log_must grep -q "${expect_str1}" $output
|
||||
log_must grep -q "${expect_str2}" $output
|
||||
|
||||
log_pass "Executing 'zfs upgrade -v' command succeeds."
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
# Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
|
||||
export DISKSARRAY=$DISKS
|
||||
echo $DISKS | read DISK0 DISK1
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
|
||||
export DISKSARRAY=$DISKS
|
||||
export SMALL_FILE_SIZE=10
|
||||
export LARGE_FILE_SIZE=80
|
||||
@@ -29,9 +29,8 @@ export SDHOSTS=1
|
||||
export SDTGTS=1
|
||||
export SDLUNS=1
|
||||
|
||||
export DISK1=$(echo $DISKS | nawk '{print $1}')
|
||||
export DISK2=$(echo $DISKS | nawk '{print $2}')
|
||||
export DISK3=$(echo $DISKS | nawk '{print $3}')
|
||||
read -r DISK1 DISK2 DISK3 _ <<<"$DISKS"
|
||||
export DISK1 DISK2 DISK3
|
||||
|
||||
if is_linux; then
|
||||
set_slice_prefix
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
# Copyright (c) 2018 by Datto. All rights reserved.
|
||||
#
|
||||
|
||||
export DISK1=$(echo $DISKS | nawk '{print $1}')
|
||||
export DISK2=$(echo $DISKS | nawk '{print $2}')
|
||||
export DISK3=$(echo $DISKS | nawk '{print $3}')
|
||||
read -r DISK1 DISK2 DISK3 _ <<<"$DISKS"
|
||||
export DISK1 DISK2 DISK3
|
||||
|
||||
export MAXTIMEOUT=300
|
||||
|
||||
@@ -14,5 +14,5 @@
|
||||
#
|
||||
|
||||
export DISKSARRAY=$DISKS
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
|
||||
set_device_dir
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
|
||||
export DISKSARRAY=$DISKS
|
||||
export FSIZE=10M
|
||||
export MAXTIMEOUT=30
|
||||
@@ -36,9 +36,8 @@ export SDHOSTS=1
|
||||
export SDTGTS=1
|
||||
export SDLUNS=1
|
||||
|
||||
export DISK1=$(echo $DISKS | nawk '{print $1}')
|
||||
export DISK2=$(echo $DISKS | nawk '{print $2}')
|
||||
export DISK3=$(echo $DISKS | nawk '{print $3}')
|
||||
read -r DISK1 DISK2 DISK3 _ <<<"$DISKS"
|
||||
export DISK1 DISK2 DISK3
|
||||
|
||||
if is_linux; then
|
||||
set_slice_prefix
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
export DISKSARRAY=$DISKS
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
|
||||
set -A disk_array $(find_disks $DISKS)
|
||||
case "${#disk_array[*]}" in
|
||||
0)
|
||||
|
||||
@@ -36,10 +36,8 @@ function check_pool_import # pool opts token keyword
|
||||
typeset keyword=$4
|
||||
|
||||
zpool import $opts 2>&1 | \
|
||||
nawk -v token="$token:" '($1==token) {print $0}' | \
|
||||
grep -i "$keyword" > /dev/null 2>&1
|
||||
|
||||
return $?
|
||||
awk -v token="$token:" '($1==token) {print}' | \
|
||||
grep -iq "$keyword"
|
||||
}
|
||||
|
||||
function is_pool_imported # pool opts
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
export DISK=${DISKS%% *}
|
||||
export DISKSARRAY=$DISKS
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
|
||||
set_device_dir
|
||||
|
||||
export TESTFILE=testfile
|
||||
|
||||
@@ -38,5 +38,5 @@ export HOLES_COUNT=${HOLES_COUNT-"16384"} # FILESIZE/BLKSIZE/8
|
||||
export STF_TIMEOUT=3600
|
||||
|
||||
export DISKSARRAY=$DISKS
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
|
||||
set_device_dir
|
||||
|
||||
@@ -101,7 +101,7 @@ function verify_slog_device
|
||||
#
|
||||
# mirror:/disks/d ONLINE mirror:/disks/e ONLINE stripe:/disks/f ONLINE
|
||||
#
|
||||
set -A dev_stat_tab $(zpool status -v $pool | nawk 'BEGIN {start=0} \
|
||||
set -A dev_stat_tab $(zpool status -v $pool | awk 'BEGIN {start=0} \
|
||||
/\tlogs/ {start=1}
|
||||
/\tmirror/ || /\tspares/ || /^$/ {start=0}
|
||||
(start==1) && /\t (\/|[a-zA-Z])/ \
|
||||
|
||||
@@ -39,5 +39,5 @@ export HOLES_COUNT=${HOLES_COUNT-"16384"} # FILESIZE/BLKSIZE/8
|
||||
export STF_TIMEOUT=3600
|
||||
|
||||
export DISKSARRAY=$DISKS
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
|
||||
set_device_dir
|
||||
|
||||
@@ -34,6 +34,6 @@ export TRUNC_FILEOFFSET=${TRUNC_FILEOFFSET-""}
|
||||
export TRUNC_COUNT=${TRUNC_COUNT-"16384"} # FILESIZE/BLKSIZE/8
|
||||
|
||||
export DISKSARRAY=$DISKS
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
|
||||
|
||||
set_device_dir
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
|
||||
export DISKSARRAY=$DISKS
|
||||
|
||||
if is_linux; then
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
|
||||
export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
|
||||
export DISKSARRAY=$DISKS
|
||||
|
||||
if is_linux; then
|
||||
|
||||
@@ -34,11 +34,11 @@
|
||||
# Remember swap devices
|
||||
#
|
||||
if is_linux; then
|
||||
SAVESWAPDEVS=$(swapon -s | nawk '(NR != 1) {print $1}')
|
||||
SAVESWAPDEVS=$(swapon -s | awk '(NR != 1) {print $1}')
|
||||
elif is_freebsd; then
|
||||
SAVESWAPDEVS=$(swapctl -l | nawk '(NR != 1) {print $1}')
|
||||
SAVESWAPDEVS=$(swapctl -l | awk '(NR != 1) {print $1}')
|
||||
else
|
||||
SAVESWAPDEVS=$(swap -l | nawk '(NR != 1) {print $1}')
|
||||
SAVESWAPDEVS=$(swap -l | awk '(NR != 1) {print $1}')
|
||||
fi
|
||||
|
||||
export BLOCKSZ=$(( 1024 * 1024 ))
|
||||
|
||||
Reference in New Issue
Block a user