aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorнаб <[email protected]>2022-03-12 00:13:19 +0100
committerBrian Behlendorf <[email protected]>2022-04-01 17:58:01 -0700
commit270d0a5a16869e2becf301ae4548ae1cefeed2fb (patch)
treef2e81f79eb4ed232fcbc2e65206a56d4738c236d
parent75746e9a40e15e7994fb99799f0b02912155f179 (diff)
tests: nawk -> awk
Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: John Kennedy <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #13259
-rwxr-xr-xscripts/zfs-tests.sh1
-rw-r--r--tests/zfs-tests/include/blkdev.shlib48
-rw-r--r--tests/zfs-tests/include/libtest.shlib25
-rw-r--r--tests/zfs-tests/tests/functional/acl/acl_common.kshlib6
-rwxr-xr-xtests/zfs-tests/tests/functional/alloc_class/alloc_class_004_pos.ksh3
-rw-r--r--tests/zfs-tests/tests/functional/cache/cache.kshlib2
-rw-r--r--tests/zfs-tests/tests/functional/cachefile/cachefile.cfg2
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_006_pos.ksh4
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_009_pos.ksh4
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_001_pos.ksh14
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_002_pos.ksh6
-rw-r--r--tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy.cfg2
-rw-r--r--tests/zfs-tests/tests/functional/cli_root/zpool_reopen/zpool_reopen.cfg7
-rw-r--r--tests/zfs-tests/tests/functional/cli_root/zpool_resilver/zpool_resilver.cfg5
-rw-r--r--tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split.cfg2
-rw-r--r--tests/zfs-tests/tests/functional/fault/fault.cfg7
-rw-r--r--tests/zfs-tests/tests/functional/migration/migration.cfg2
-rw-r--r--tests/zfs-tests/tests/functional/mmp/mmp.kshlib6
-rw-r--r--tests/zfs-tests/tests/functional/mv_files/mv_files.cfg2
-rw-r--r--tests/zfs-tests/tests/functional/online_offline/online_offline.cfg2
-rw-r--r--tests/zfs-tests/tests/functional/slog/slog.kshlib2
-rw-r--r--tests/zfs-tests/tests/functional/sparse/sparse.cfg2
-rw-r--r--tests/zfs-tests/tests/functional/truncate/truncate.cfg2
-rw-r--r--tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg2
-rw-r--r--tests/zfs-tests/tests/functional/zvol/zvol_cli/zvol_cli.cfg2
-rw-r--r--tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap.cfg6
26 files changed, 68 insertions, 98 deletions
diff --git a/scripts/zfs-tests.sh b/scripts/zfs-tests.sh
index 94c6ab0b1..6e9589e59 100755
--- a/scripts/zfs-tests.sh
+++ b/scripts/zfs-tests.sh
@@ -297,7 +297,6 @@ constrain_path() {
create_links "$SYSTEM_DIRS" "$SYSTEM_FILES"
# Exceptions
- ln -fs "$STF_PATH/awk" "$STF_PATH/nawk"
if [ "$UNAME" = "Linux" ] ; then
ln -fs /sbin/fsck.ext4 "$STF_PATH/fsck"
ln -fs /sbin/mkfs.ext4 "$STF_PATH/newfs"
diff --git a/tests/zfs-tests/include/blkdev.shlib b/tests/zfs-tests/include/blkdev.shlib
index 6d37494ee..f776caa3b 100644
--- a/tests/zfs-tests/include/blkdev.shlib
+++ b/tests/zfs-tests/include/blkdev.shlib
@@ -253,7 +253,7 @@ function set_device_dir
if is_linux; then
while (( i < $DISK_ARRAY_NUM )); do
- disk="$(echo $DISKS | nawk '{print $(i + 1)}')"
+ disk="$(echo $DISKS | awk '{print $(i + 1)}')"
if is_mpath_device $disk; then
export DEV_DSKDIR=$DEV_MPATHDIR
return 0
@@ -294,20 +294,15 @@ function get_device_dir #device
function get_persistent_disk_name #device
{
typeset device=$1
- typeset dev_id
if is_linux; then
if is_real_device $device; then
- dev_id="$(udevadm info -q all -n $DEV_DSKDIR/$device \
- | egrep disk/by-id | nawk '{print $2; exit}' \
- | nawk -F / '{print $3}')"
- echo $dev_id
+ udevadm info -q all -n $DEV_DSKDIR/$device \
+ | awk '/disk\/by-id/ {print $2; exit}' | cut -d/ -f3
elif is_mpath_device $device; then
- dev_id="$(udevadm info -q all -n $DEV_DSKDIR/$device \
- | egrep disk/by-id/dm-uuid \
- | nawk '{print $2; exit}' \
- | nawk -F / '{print $3}')"
- echo $dev_id
+ udevadm info -q all -n $DEV_DSKDIR/$device \
+ | awk '/disk\/by-id\/dm-uuid/ {print $2; exit}' \
+ | cut -d/ -f3
else
echo $device
fi
@@ -334,28 +329,22 @@ function on_off_disk # disk state{online,offline} host
if is_linux; then
if [[ $state == "offline" ]] && ( is_mpath_device $disk ); then
- dm_name="$(readlink $DEV_DSKDIR/$disk \
- | nawk -F / '{print $2}')"
- dep="$(ls /sys/block/${dm_name}/slaves \
- | nawk '{print $1}')"
+ dm_name="$(readlink $DEV_DSKDIR/$disk | cut -d/ -f2)"
+ dep="$(ls /sys/block/${dm_name}/slaves | awk '{print $1}')"
while [[ -n $dep ]]; do
#check if disk is online
- lsscsi | egrep $dep > /dev/null
- if (($? == 0)); then
+ if lsscsi | egrep -q $dep; then
dep_dir="/sys/block/${dm_name}"
dep_dir+="/slaves/${dep}/device"
ss="${dep_dir}/state"
sd="${dep_dir}/delete"
log_must eval "echo 'offline' > ${ss}"
log_must eval "echo '1' > ${sd}"
- lsscsi | egrep $dep > /dev/null
- if (($? == 0)); then
- log_fail "Offlining" \
- "$disk failed"
- fi
+ if lsscsi | egrep -q $dep; then
+ log_fail "Offlining $disk failed"
+ fi
fi
- dep="$(ls /sys/block/$dm_name/slaves \
- 2>/dev/null | nawk '{print $1}')"
+ dep="$(ls /sys/block/$dm_name/slaves 2>/dev/null | awk '{print $1}')"
done
elif [[ $state == "offline" ]] && ( is_real_device $disk ); then
#check if disk is online
@@ -378,12 +367,9 @@ function on_off_disk # disk state{online,offline} host
scan_scsi_hosts $host
block_device_wait
if is_mpath_device $disk; then
- dm_name="$(readlink $DEV_DSKDIR/$disk \
- | nawk -F / '{print $2}')"
- dep="$(ls /sys/block/$dm_name/slaves \
- | nawk '{print $1}')"
- lsscsi | egrep $dep > /dev/null
- if (($? != 0)); then
+ dm_name="$(readlink $DEV_DSKDIR/$disk | cut -d/ -f2)"
+ dep="$(ls /sys/block/$dm_name/slaves | awk '{print $1}')"
+ if lsscsi | egrep -q $dep; then
log_fail "Onlining $disk failed"
fi
elif is_real_device $disk; then
@@ -496,7 +482,7 @@ function unload_scsi_debug
function get_debug_device
{
for i in {1..10} ; do
- val=$(lsscsi | nawk '/scsi_debug/ {print $6; exit}' | cut -d / -f3)
+ val=$(lsscsi | awk '/scsi_debug/ {print $6; exit}' | cut -d/ -f3)
# lsscsi can take time to settle
if [ "$val" != "-" ] ; then
diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib
index 60d54428a..58e992698 100644
--- a/tests/zfs-tests/include/libtest.shlib
+++ b/tests/zfs-tests/include/libtest.shlib
@@ -2018,13 +2018,8 @@ function verify_pool
#
function get_disklist # pool
{
- typeset disklist=""
-
- disklist=$(zpool iostat -v $1 | nawk '(NR >4) {print $1}' | \
- grep -v "\-\-\-\-\-" | \
- egrep -v -e "^(mirror|raidz[1-3]|draid[1-3]|spare|log|cache|special|dedup)|\-[0-9]$")
-
- echo $disklist
+ zpool iostat -v $1 | awk '(NR > 4) {print $1}' | \
+ egrep -v -e '^-----' -e "^(mirror|raidz[1-3]|draid[1-3]|spare|log|cache|special|dedup)|\-[0-9]$"
}
#
@@ -2033,8 +2028,7 @@ function get_disklist # pool
#
function get_disklist_fullpath # pool
{
- args="-P $1"
- get_disklist $args
+ get_disklist "-P $1"
}
@@ -2183,14 +2177,12 @@ function check_pool_status # pool token keyword <verbose>
typeset keyword=$3
typeset verbose=${4:-false}
- scan=$(zpool status -v "$pool" 2>/dev/null | nawk -v token="$token:" '
+ scan=$(zpool status -v "$pool" 2>/dev/null | awk -v token="$token:" '
($1==token) {print $0}')
if [[ $verbose == true ]]; then
log_note $scan
fi
- echo $scan | egrep -i "$keyword" > /dev/null 2>&1
-
- return $?
+ echo $scan | egrep -qi "$keyword"
}
#
@@ -2968,15 +2960,14 @@ function get_device_state #pool disk field("", "spares","logs")
typeset disk=${2#$DEV_DSKDIR/}
typeset field=${3:-$pool}
- state=$(zpool status -v "$pool" 2>/dev/null | \
- nawk -v device=$disk -v pool=$pool -v field=$field \
+ zpool status -v "$pool" 2>/dev/null | \
+ awk -v device=$disk -v pool=$pool -v field=$field \
'BEGIN {startconfig=0; startfield=0; }
/config:/ {startconfig=1}
(startconfig==1) && ($1==field) {startfield=1; next;}
(startfield==1) && ($1==device) {print $2; exit;}
(startfield==1) &&
- ($1==field || $1 ~ "^spares$" || $1 ~ "^logs$") {startfield=0}')
- echo $state
+ ($1==field || $1 ~ "^spares$" || $1 ~ "^logs$") {startfield=0}'
}
#
diff --git a/tests/zfs-tests/tests/functional/acl/acl_common.kshlib b/tests/zfs-tests/tests/functional/acl/acl_common.kshlib
index c2e09687e..bfae8ec72 100644
--- a/tests/zfs-tests/tests/functional/acl/acl_common.kshlib
+++ b/tests/zfs-tests/tests/functional/acl/acl_common.kshlib
@@ -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}'
diff --git a/tests/zfs-tests/tests/functional/alloc_class/alloc_class_004_pos.ksh b/tests/zfs-tests/tests/functional/alloc_class/alloc_class_004_pos.ksh
index 79ac9364c..04ce486ad 100755
--- a/tests/zfs-tests/tests/functional/alloc_class/alloc_class_004_pos.ksh
+++ b/tests/zfs-tests/tests/functional/alloc_class/alloc_class_004_pos.ksh
@@ -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
diff --git a/tests/zfs-tests/tests/functional/cache/cache.kshlib b/tests/zfs-tests/tests/functional/cache/cache.kshlib
index 2e258e22c..58e2385ea 100644
--- a/tests/zfs-tests/tests/functional/cache/cache.kshlib
+++ b/tests/zfs-tests/tests/functional/cache/cache.kshlib
@@ -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])/ \
diff --git a/tests/zfs-tests/tests/functional/cachefile/cachefile.cfg b/tests/zfs-tests/tests/functional/cachefile/cachefile.cfg
index d93ec3ed6..bd48cfdf2 100644
--- a/tests/zfs-tests/tests/functional/cachefile/cachefile.cfg
+++ b/tests/zfs-tests/tests/functional/cachefile/cachefile.cfg
@@ -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
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_006_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_006_pos.ksh
index 42628a051..c5dfb8939 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_006_pos.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_006_pos.ksh
@@ -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 ]] && \
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_009_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_009_pos.ksh
index 407936c7c..407c8f291 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_009_pos.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_009_pos.ksh
@@ -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"
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_001_pos.ksh
index 3b4451c74..db8b96f50 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_001_pos.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_001_pos.ksh
@@ -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
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_002_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_002_pos.ksh
index ba6e7c483..994ee2b34 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_002_pos.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_002_pos.ksh
@@ -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."
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy.cfg b/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy.cfg
index bf6026747..906cba700 100644
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy.cfg
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy.cfg
@@ -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
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/zpool_reopen.cfg b/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/zpool_reopen.cfg
index 7451ffd8c..35beb568c 100644
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/zpool_reopen.cfg
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/zpool_reopen.cfg
@@ -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
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_resilver/zpool_resilver.cfg b/tests/zfs-tests/tests/functional/cli_root/zpool_resilver/zpool_resilver.cfg
index 2a942d69f..2b8c9e954 100644
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_resilver/zpool_resilver.cfg
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_resilver/zpool_resilver.cfg
@@ -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
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split.cfg b/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split.cfg
index 5833a420c..a441a7dff 100644
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split.cfg
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split.cfg
@@ -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
diff --git a/tests/zfs-tests/tests/functional/fault/fault.cfg b/tests/zfs-tests/tests/functional/fault/fault.cfg
index 839330ed4..108406e3e 100644
--- a/tests/zfs-tests/tests/functional/fault/fault.cfg
+++ b/tests/zfs-tests/tests/functional/fault/fault.cfg
@@ -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
diff --git a/tests/zfs-tests/tests/functional/migration/migration.cfg b/tests/zfs-tests/tests/functional/migration/migration.cfg
index a8a24e0a3..308891b86 100644
--- a/tests/zfs-tests/tests/functional/migration/migration.cfg
+++ b/tests/zfs-tests/tests/functional/migration/migration.cfg
@@ -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)
diff --git a/tests/zfs-tests/tests/functional/mmp/mmp.kshlib b/tests/zfs-tests/tests/functional/mmp/mmp.kshlib
index 5fb22bd85..7ff2636e1 100644
--- a/tests/zfs-tests/tests/functional/mmp/mmp.kshlib
+++ b/tests/zfs-tests/tests/functional/mmp/mmp.kshlib
@@ -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
diff --git a/tests/zfs-tests/tests/functional/mv_files/mv_files.cfg b/tests/zfs-tests/tests/functional/mv_files/mv_files.cfg
index ed28ff1ef..fbab8f6da 100644
--- a/tests/zfs-tests/tests/functional/mv_files/mv_files.cfg
+++ b/tests/zfs-tests/tests/functional/mv_files/mv_files.cfg
@@ -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
diff --git a/tests/zfs-tests/tests/functional/online_offline/online_offline.cfg b/tests/zfs-tests/tests/functional/online_offline/online_offline.cfg
index ae4cb69ad..6f1121c5e 100644
--- a/tests/zfs-tests/tests/functional/online_offline/online_offline.cfg
+++ b/tests/zfs-tests/tests/functional/online_offline/online_offline.cfg
@@ -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
diff --git a/tests/zfs-tests/tests/functional/slog/slog.kshlib b/tests/zfs-tests/tests/functional/slog/slog.kshlib
index 75cfec2d8..8bc34d0da 100644
--- a/tests/zfs-tests/tests/functional/slog/slog.kshlib
+++ b/tests/zfs-tests/tests/functional/slog/slog.kshlib
@@ -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])/ \
diff --git a/tests/zfs-tests/tests/functional/sparse/sparse.cfg b/tests/zfs-tests/tests/functional/sparse/sparse.cfg
index 0fc669148..b7e403bce 100644
--- a/tests/zfs-tests/tests/functional/sparse/sparse.cfg
+++ b/tests/zfs-tests/tests/functional/sparse/sparse.cfg
@@ -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
diff --git a/tests/zfs-tests/tests/functional/truncate/truncate.cfg b/tests/zfs-tests/tests/functional/truncate/truncate.cfg
index 13cdafab1..d852ee63a 100644
--- a/tests/zfs-tests/tests/functional/truncate/truncate.cfg
+++ b/tests/zfs-tests/tests/functional/truncate/truncate.cfg
@@ -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
diff --git a/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg b/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg
index 8a99225ba..92650c5e0 100644
--- a/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg
+++ b/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg
@@ -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
diff --git a/tests/zfs-tests/tests/functional/zvol/zvol_cli/zvol_cli.cfg b/tests/zfs-tests/tests/functional/zvol/zvol_cli/zvol_cli.cfg
index 8a99225ba..92650c5e0 100644
--- a/tests/zfs-tests/tests/functional/zvol/zvol_cli/zvol_cli.cfg
+++ b/tests/zfs-tests/tests/functional/zvol/zvol_cli/zvol_cli.cfg
@@ -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
diff --git a/tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap.cfg b/tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap.cfg
index 54ecc18b5..b6501da9c 100644
--- a/tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap.cfg
+++ b/tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap.cfg
@@ -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 ))