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/userquota/userquota_common.kshlib
          +++ new/usr/src/test/zfs-tests/tests/functional/userquota/userquota_common.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  . $STF_SUITE/tests/functional/userquota/userquota.cfg
  33   33  
  34   34  #
  35   35  # reset the userquota and groupquota and delete temporary files
  36   36  #
  37   37  function cleanup_quota
  38   38  {
  39   39          if datasetexists $QFS; then
  40      -                log_must $ZFS set userquota@$QUSER1=none $QFS
  41      -                log_must $ZFS set userquota@$QUSER2=none $QFS
  42      -                log_must $ZFS set groupquota@$QGROUP=none $QFS
       40 +                log_must zfs set userquota@$QUSER1=none $QFS
       41 +                log_must zfs set userquota@$QUSER2=none $QFS
       42 +                log_must zfs set groupquota@$QGROUP=none $QFS
  43   43                  recovery_writable $QFS
  44   44          fi
  45   45  
  46      -        [[ -f $QFILE ]] && log_must $RM -f $QFILE
  47      -        [[ -f $OFILE ]] && log_must $RM -f $OFILE
  48      -        $SYNC
       46 +        [[ -f $QFILE ]] && log_must rm -f $QFILE
       47 +        [[ -f $OFILE ]] && log_must rm -f $OFILE
       48 +        sync
  49   49  
  50   50           return 0
  51   51  }
  52   52  
  53   53  #
  54   54  # delete user and group that created during the test
  55   55  #
  56   56  function clean_user_group
  57   57  {
  58   58          for usr in $QUSER1 $QUSER2; do
↓ open down ↓ 5 lines elided ↑ open up ↑
  64   64          return 0
  65   65  }
  66   66  
  67   67  #
  68   68  #  make the $QFS's mountpoint writable for all users
  69   69  #
  70   70  function mkmount_writable
  71   71  {
  72   72          typeset fs=$1
  73   73          typeset mntp=$(get_prop mountpoint $fs)
  74      -        log_must $CHMOD 0777 $mntp
       74 +        log_must chmod 0777 $mntp
  75   75  }
  76   76  
  77   77  #
  78   78  # recovery the directory permission for $QFS
  79   79  #
  80   80  function recovery_writable
  81   81  {
  82   82          typeset fs=$1
  83   83          typeset mntp=$(get_prop mountpoint $fs)
  84      -        log_must $CHMOD 0755 $mntp
       84 +        log_must chmod 0755 $mntp
  85   85  }
  86   86  
  87   87  #
  88   88  # check the quota value of a specific FS
  89   89  #
  90   90  function check_quota
  91   91  {
  92   92          typeset fs=$2
  93   93          typeset prop=$1
  94   94          typeset expected=$3
↓ open down ↓ 6 lines elided ↑ open up ↑
 101  101  
 102  102  #
 103  103  # zfs get prop, which return raw value not -p value.
 104  104  #
 105  105  function get_value # property dataset
 106  106  {
 107  107          typeset prop_val
 108  108          typeset prop=$1
 109  109          typeset dataset=$2
 110  110  
 111      -        prop_val=$($ZFS get -H -o value $prop $dataset 2>/dev/null)
      111 +        prop_val=$(zfs get -H -o value $prop $dataset 2>/dev/null)
 112  112          if [[ $? -ne 0 ]]; then
 113  113                  log_note "Unable to get $prop property for dataset " \
 114  114                  "$dataset"
 115  115                  return 1
 116  116          fi
 117  117  
 118      -        $ECHO $prop_val
      118 +        echo $prop_val
 119  119          return 0
 120  120  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX