Print this page
12181 zvol swap tests should avoid grep -w
@@ -26,10 +26,11 @@
#
#
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
# Copyright 2016 Nexenta Systems, Inc.
+# Copyright 2020 Joyent, Inc.
#
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/zvol/zvol_common.shlib
@@ -52,11 +53,12 @@
typeset dumpdev=$(get_dumpdevice)
if [[ $dumpdev != $savedumpdev ]] ; then
safe_dumpadm $savedumpdev
fi
- swap -l | grep -w $voldev > /dev/null 2>&1
+ swap -l | awk 'NR > 1 { print $1 }' | \
+ grep "^$voldev\$" > /dev/null 2>&1
if (( $? == 0 )); then
log_must swap -d $voldev
fi
typeset snap