aboutsummaryrefslogtreecommitdiffstats
path: root/tests/zfs-tests/include/libtest.shlib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/zfs-tests/include/libtest.shlib')
-rw-r--r--tests/zfs-tests/include/libtest.shlib25
1 files changed, 8 insertions, 17 deletions
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}'
}
#