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/slog/slog.kshlib
          +++ new/usr/src/test/zfs-tests/tests/functional/slog/slog.kshlib
↓ open down ↓ 17 lines elided ↑ open up ↑
  18   18  #
  19   19  # CDDL HEADER END
  20   20  #
  21   21  
  22   22  #
  23   23  # Copyright 2008 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  . $STF_SUITE/tests/functional/slog/slog.cfg
  33   33  
  34   34  function cleanup
  35   35  {
  36   36          if datasetexists $TESTPOOL ; then
  37      -                log_must $ZPOOL destroy -f $TESTPOOL
       37 +                log_must zpool destroy -f $TESTPOOL
  38   38          fi
  39   39          if datasetexists $TESTPOOL2 ; then
  40      -                log_must $ZPOOL destroy -f $TESTPOOL2
       40 +                log_must zpool destroy -f $TESTPOOL2
  41   41          fi
  42   42  }
  43   43  
  44   44  #
  45   45  # Try zpool status/iostat for given pool
  46   46  #
  47   47  # $1 pool
  48   48  #
  49   49  function display_status
  50   50  {
  51   51          typeset pool=$1
  52   52  
  53   53          typeset -i ret=0
  54      -        $ZPOOL status -xv $pool > /dev/null 2>&1
       54 +        zpool status -xv $pool > /dev/null 2>&1
  55   55          ret=$?
  56   56  
  57      -        $ZPOOL iostat > /dev/null 2>&1
       57 +        zpool iostat > /dev/null 2>&1
  58   58          ((ret |= $?))
  59   59  
  60   60          typeset mntpnt=$(get_prop mountpoint $pool)
  61      -        $DD if=/dev/random of=$mntpnt/testfile.$$ &
       61 +        dd if=/dev/random of=$mntpnt/testfile.$$ &
  62   62          typeset pid=$!
  63   63  
  64      -        $ZPOOL iostat -v 1 3 > /dev/null
       64 +        zpool iostat -v 1 3 > /dev/null
  65   65          ((ret |= $?))
  66   66  
  67   67          kill -9 $pid
  68   68  
  69   69          return $ret
  70   70  }
  71   71  
  72   72  #
  73   73  # Verify the give slog device have correct type and status
  74   74  #
↓ open down ↓ 12 lines elided ↑ open up ↑
  87   87          if [[ -z $pool || -z $device || -z $status ]]; then
  88   88                  log_fail "Usage: verify_slog_device <pool> <device> " \
  89   89                          "<status> [type]"
  90   90          fi
  91   91  
  92   92          #
  93   93          # Get all the slog devices and status table like below
  94   94          #
  95   95          # mirror:/disks/d ONLINE mirror:/disks/e ONLINE stripe:/disks/f ONLINE
  96   96          #
  97      -        set -A dev_stat_tab $($ZPOOL status -v $pool | $NAWK 'BEGIN {start=0} \
       97 +        set -A dev_stat_tab $(zpool status -v $pool | nawk 'BEGIN {start=0} \
  98   98                                  /\tlogs/ {start=1}
  99   99                                  /\tmirror/ || /\tspares/ || /^$/ {start=0}
 100  100                                  (start==1) && /\t  (\/|[a-zA-Z])/ \
 101  101                                          {print "stripe:" $1 " " $2}
 102  102                                  (start==1) && /\t    (\/|[a-zA-Z])/ \
 103  103                                          {print "mirror:" $1 " " $2}
 104  104                                  # When hotspare is replacing
 105  105                                  (start==1) && /\t      (\/|[a-zA-Z])/ \
 106  106                                          {print "mirror:" $1 " " $2}'
 107  107                               )
↓ open down ↓ 43 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX