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

Split Close
Expand all
Collapse all
          --- old/usr/src/test/zfs-tests/tests/functional/zvol/zvol_common.shlib
          +++ new/usr/src/test/zfs-tests/tests/functional/zvol/zvol_common.shlib
↓ open down ↓ 18 lines elided ↑ open up ↑
  19   19  # CDDL HEADER END
  20   20  #
  21   21  
  22   22  #
  23   23  # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24   24  # Use is subject to license terms.
  25   25  #
  26   26  
  27   27  #
  28   28  # Copyright (c) 2013, 2016 by Delphix. All rights reserved.
       29 +# Copyright 2020 Joyent, Inc.
  29   30  #
  30   31  
  31   32  . $STF_SUITE/include/libtest.shlib
  32   33  . $STF_SUITE/tests/functional/zvol/zvol.cfg
  33   34  
  34   35  #
  35   36  # Create a simple zvol volume
  36   37  #
  37   38  # Where disk_device: is the name of the disk to be used
  38   39  #       volume_size: is the size of the volume, e.g. 2G
↓ open down ↓ 87 lines elided ↑ open up ↑
 126  127  
 127  128  function is_swap_inuse
 128  129  {
 129  130          typeset device=$1
 130  131  
 131  132          if [[ -z $device ]] ; then
 132  133                  log_note "No device specified."
 133  134                  return 1
 134  135          fi
 135  136  
 136      -        swap -l | grep -w $device > /dev/null 2>&1
      137 +        swap -l | awk 'NR > 1 { print $1 }' | \
      138 +            grep "^$device\$" > /dev/null 2>&1
 137  139          return $?
 138  140  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX