Print this page
12181 zvol swap tests should avoid grep -w

@@ -24,10 +24,11 @@
 # Use is subject to license terms.
 #
 
 #
 # Copyright (c) 2013, 2016 by Delphix. All rights reserved.
+# Copyright 2020 Joyent, Inc.
 #
 
 . $STF_SUITE/include/libtest.shlib
 . $STF_SUITE/tests/functional/zvol/zvol.cfg
 

@@ -131,8 +132,9 @@
         if [[ -z $device ]] ; then
                 log_note "No device specified."
                 return 1
         fi
 
-        swap -l | grep -w $device > /dev/null 2>&1
+        swap -l | awk 'NR > 1 { print $1 }' | \
+            grep "^$device\$" > /dev/null 2>&1
         return $?
 }