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/rsend/rsend_012_pos.ksh
          +++ new/usr/src/test/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh
↓ open down ↓ 18 lines elided ↑ open up ↑
  19   19  #
  20   20  # CDDL HEADER END
  21   21  #
  22   22  
  23   23  #
  24   24  # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  25   25  # Use is subject to license terms.
  26   26  #
  27   27  
  28   28  #
  29      -# Copyright (c) 2013 by Delphix. All rights reserved.
       29 +# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
  30   30  #
  31   31  
  32   32  . $STF_SUITE/tests/functional/rsend/rsend.kshlib
  33   33  
  34   34  #
  35   35  # DESCRIPTION:
  36   36  #       zfs send -R will backup all the filesystem properties correctly.
  37   37  #
  38   38  # STRATEGY:
  39   39  #       1. Setting properties for all the filesystem and volumes randomly
↓ open down ↓ 4 lines elided ↑ open up ↑
  44   44  
  45   45  verify_runnable "global"
  46   46  
  47   47  function rand_set_prop
  48   48  {
  49   49          typeset dtst=$1
  50   50          typeset prop=$2
  51   51          shift 2
  52   52          typeset value=$(random_get $@)
  53   53  
  54      -        log_must eval "$ZFS set $prop='$value' $dtst"
       54 +        log_must eval "zfs set $prop='$value' $dtst"
  55   55  }
  56   56  
  57   57  function edited_prop
  58   58  {
  59   59          typeset behaviour=$1
  60   60          typeset ds=$2
  61   61          typeset backfile=$TESTDIR/edited_prop_$ds
  62   62  
  63   63          case $behaviour in
  64   64                  "get")
  65      -                        typeset props=$($ZFS inherit 2>&1 | \
  66      -                                $AWK '$2=="YES" {print $1}' | \
  67      -                                $EGREP -v "^vol|\.\.\.$")
       65 +                        typeset props=$(zfs inherit 2>&1 | \
       66 +                                awk '$2=="YES" {print $1}' | \
       67 +                                egrep -v "^vol|\.\.\.$")
  68   68                          for item in $props ; do
  69   69                                  if [[ $item == "mlslabel" ]] && \
  70   70                                          ! is_te_enabled ; then
  71   71                                          continue
  72   72                                  fi
  73      -                                $ZFS get -H -o property,value $item $ds >> \
       73 +                                zfs get -H -o property,value $item $ds >> \
  74   74                                          $backfile
  75   75                                  if (($? != 0)); then
  76   76                                          log_fail "zfs get -H -o property,value"\
  77   77                                                  "$item $ds > $backfile"
  78   78                                  fi
  79   79                          done
  80   80                          ;;
  81   81                  "set")
  82   82                          if [[ ! -f $backfile ]] ; then
  83   83                                  log_fail "$ds need backup properties firstly."
  84   84                          fi
  85   85  
  86   86                          typeset prop value
  87   87                          while read prop value ; do
  88      -                                eval $ZFS set $prop='$value' $ds
       88 +                                eval zfs set $prop='$value' $ds
  89   89                                  if (($? != 0)); then
  90      -                                        log_fail "$ZFS set $prop=$value $ds"
       90 +                                        log_fail "zfs set $prop=$value $ds"
  91   91                                  fi
  92   92                          done < $backfile
  93   93                          ;;
  94   94                  *)
  95   95                          log_fail "Unrecognized behaviour: $behaviour"
  96   96          esac
  97   97  }
  98   98  
  99   99  function cleanup
 100  100  {
 101  101          log_must cleanup_pool $POOL
 102  102          log_must cleanup_pool $POOL2
 103  103  
 104  104          log_must edited_prop "set" $POOL
 105  105          log_must edited_prop "set" $POOL2
 106  106  
 107  107          typeset prop
 108  108          for prop in $(fs_inherit_prop) ; do
 109      -                log_must $ZFS inherit $prop $POOL
 110      -                log_must $ZFS inherit $prop $POOL2
      109 +                log_must zfs inherit $prop $POOL
      110 +                log_must zfs inherit $prop $POOL2
 111  111          done
 112  112  
 113  113          #if is_shared $POOL; then
 114      -        #       log_must $ZFS set sharenfs=off $POOL
      114 +        #       log_must zfs set sharenfs=off $POOL
 115  115          #fi
 116  116          log_must setup_test_model $POOL
 117  117  
 118  118          if [[ -d $TESTDIR ]]; then
 119      -                log_must $RM -rf $TESTDIR/*
      119 +                log_must rm -rf $TESTDIR/*
 120  120          fi
 121  121  }
 122  122  
 123  123  log_assert "Verify zfs send -R will backup all the filesystem properties " \
 124  124          "correctly."
 125  125  log_onexit cleanup
 126  126  
 127  127  log_must edited_prop "get" $POOL
 128  128  log_must edited_prop "get" $POOL2
 129  129  
↓ open down ↓ 28 lines elided ↑ open up ↑
 158  158          rand_set_prop $vol user:prop "aaa" "bbb" "23421" "()-+?"
 159  159  done
 160  160  
 161  161  
 162  162  # Verify inherited property can be received
 163  163  rand_set_prop $POOL sharenfs "on" "off" "rw"
 164  164  
 165  165  #
 166  166  # Duplicate POOL2 for testing
 167  167  #
 168      -log_must eval "$ZFS send -R $POOL@final > $BACKDIR/pool-final-R"
 169      -log_must eval "$ZFS receive -d -F $POOL2 < $BACKDIR/pool-final-R"
      168 +log_must eval "zfs send -R $POOL@final > $BACKDIR/pool-final-R"
      169 +log_must eval "zfs receive -d -F $POOL2 < $BACKDIR/pool-final-R"
 170  170  
 171  171  #
 172  172  # Define all the POOL/POOL2 datasets pair
 173  173  #
 174  174  set -A pair     "$POOL"                 "$POOL2"                \
 175  175                  "$POOL/$FS"             "$POOL2/$FS"            \
 176  176                  "$POOL/$FS/fs1"         "$POOL2/$FS/fs1"        \
 177  177                  "$POOL/$FS/fs1/fs2"     "$POOL2/$FS/fs1/fs2"    \
 178  178                  "$POOL/pclone"          "$POOL2/pclone"         \
 179  179                  "$POOL/$FS/fs1/fclone"  "$POOL2/$FS/fs1/fclone" \
↓ open down ↓ 1 lines elided ↑ open up ↑
 181  181                  "$POOL/$FS/vol"         "$POOL2/$FS/vol"
 182  182  
 183  183  typeset -i i=0
 184  184  while ((i < ${#pair[@]})); do
 185  185          log_must cmp_ds_prop ${pair[$i]} ${pair[((i+1))]}
 186  186  
 187  187          ((i += 2))
 188  188  done
 189  189  
 190  190  
 191      -$ZPOOL upgrade -v | $GREP "Snapshot properties" > /dev/null 2>&1
      191 +zpool upgrade -v | grep "Snapshot properties" > /dev/null 2>&1
 192  192  if (( $? == 0 )) ; then
 193  193          i=0
 194  194          while ((i < ${#pair[@]})); do
 195  195                  log_must cmp_ds_prop ${pair[$i]}@final ${pair[((i+1))]}@final
 196  196                  ((i += 2))
 197  197          done
 198  198  fi
 199  199  
 200  200  log_pass "Verify zfs send -R will backup all the filesystem properties " \
 201  201          "correctly."
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX