Print this page
7290 ZFS test suite needs to control what utilities it can run
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/test/zfs-tests/tests/functional/cache/cache.kshlib
          +++ new/usr/src/test/zfs-tests/tests/functional/cache/cache.kshlib
↓ open down ↓ 17 lines elided ↑ open up ↑
  18   18  #
  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      -# Copyright (c) 2013 by Delphix. All rights reserved.
       28 +# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
  29   29  #
  30   30  
  31   31  . $STF_SUITE/include/libtest.shlib
  32   32  
  33   33  function cleanup
  34   34  {
  35   35          if datasetexists $TESTPOOL ; then
  36      -                log_must $ZPOOL destroy -f $TESTPOOL
       36 +                log_must zpool destroy -f $TESTPOOL
  37   37          fi
  38   38          if datasetexists $TESTPOOL2 ; then
  39      -                log_must $ZPOOL destroy -f $TESTPOOL2
       39 +                log_must zpool destroy -f $TESTPOOL2
  40   40          fi
  41   41  }
  42   42  
  43   43  #
  44   44  # Try zpool status/iostat for given pool
  45   45  #
  46   46  # $1 pool
  47   47  #
  48   48  function display_status
  49   49  {
  50   50          typeset pool=$1
  51   51  
  52   52          typeset -i ret=0
  53      -        $ZPOOL status -xv $pool > /dev/null 2>&1
       53 +        zpool status -xv $pool > /dev/null 2>&1
  54   54          ret=$?
  55   55  
  56      -        $ZPOOL iostat > /dev/null 2>&1
       56 +        zpool iostat > /dev/null 2>&1
  57   57          ((ret |= $?))
  58   58  
  59   59          typeset mntpnt=$(get_prop mountpoint $pool)
  60      -        $DD if=/dev/random of=$mntpnt/testfile.$$ &
       60 +        dd if=/dev/random of=$mntpnt/testfile.$$ &
  61   61          typeset pid=$!
  62   62  
  63      -        $ZPOOL iostat -v 1 3 > /dev/null
       63 +        zpool iostat -v 1 3 > /dev/null
  64   64          ((ret |= $?))
  65   65  
  66   66          kill -9 $pid
  67   67  
  68   68          return $ret
  69   69  }
  70   70  
  71   71  #
  72   72  # Verify the given cache device have correct type and status
  73   73  #
↓ open down ↓ 12 lines elided ↑ open up ↑
  86   86          if [[ -z $pool || -z $device || -z $status ]]; then
  87   87                  log_fail "Usage: verify_cache_device <pool> <device> " \
  88   88                          "<status> [type]"
  89   89          fi
  90   90  
  91   91          #
  92   92          # Get all the cache devices and status table like below
  93   93          #
  94   94          # mirror:/disks/d ONLINE mirror:/disks/e ONLINE stripe:/disks/f ONLINE
  95   95          #
  96      -        set -A dev_stat_tab $($ZPOOL status -v $pool | $NAWK 'BEGIN {start=0} \
       96 +        set -A dev_stat_tab $(zpool status -v $pool | nawk 'BEGIN {start=0} \
  97   97                                  /\tcache/ {start=1}
  98   98                                  /\tmirror/ || /\tspares/ || /^$/ {start=0}
  99   99                                  (start==1) && /\t  (\/|[a-zA-Z])/ \
 100  100                                          {print "stripe:" $1 " " $2}
 101  101                                  (start==1) && /\t    (\/|[a-zA-Z])/ \
 102  102                                          {print "mirror:" $1 " " $2}
 103  103                                  # When hotspare is replacing
 104  104                                  (start==1) && /\t      (\/|[a-zA-Z])/ \
 105  105                                          {print "mirror:" $1 " " $2}'
 106  106                               )
↓ open down ↓ 34 lines elided ↑ open up ↑
 141  141                  esac
 142  142                  ((i += 2))
 143  143          done
 144  144  
 145  145          log_note "Can not find device: $device"
 146  146          return 1
 147  147  }
 148  148  
 149  149  function verify_cache_support
 150  150  {
 151      -        $ZPOOL upgrade -v | $GREP "Cache devices" > /dev/null 2>&1
      151 +        zpool upgrade -v | grep "Cache devices" > /dev/null 2>&1
 152  152          return $?
 153  153  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX