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/cli_user/misc/setup.ksh
          +++ new/usr/src/test/zfs-tests/tests/functional/cli_user/misc/setup.ksh
↓ open down ↓ 18 lines elided ↑ open up ↑
  19   19  #
  20   20  # CDDL HEADER END
  21   21  #
  22   22  
  23   23  #
  24   24  # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  25   25  # Use is subject to license terms.
  26   26  #
  27   27  
  28   28  #
  29      -# Copyright (c) 2013, 2015 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/cli_user/misc/misc.cfg
  33   33  . $STF_SUITE/include/libtest.shlib
  34   34  
  35   35  # This setup script is moderately complex, as it creates scenarios for all
  36   36  # of the tests included in this directory. Usually we'd want each test case
  37   37  # to setup/teardown it's own configuration, but this would be time consuming
  38   38  # given the nature of these tests. However, as a side-effect, one test
  39   39  # leaving the system in an unknown state could impact other test cases.
↓ open down ↓ 5 lines elided ↑ open up ↑
  45   45  
  46   46  # Create a default setup that includes a volume
  47   47  default_setup_noexit "$DISK" "" "volume"
  48   48  
  49   49  #
  50   50  # The rest of this setup script creates a ZFS filesystem configuration
  51   51  # that is used to test the rest of the zfs subcommands in this directory.
  52   52  #
  53   53  
  54   54  # create a snapshot and a clone to test clone promote
  55      -log_must $ZFS snapshot $TESTPOOL/$TESTFS@snap
  56      -log_must $ZFS clone $TESTPOOL/$TESTFS@snap $TESTPOOL/$TESTFS/clone
       55 +log_must zfs snapshot $TESTPOOL/$TESTFS@snap
       56 +log_must zfs clone $TESTPOOL/$TESTFS@snap $TESTPOOL/$TESTFS/clone
  57   57  # create a file in the filesystem that isn't in the above snapshot
  58      -$TOUCH /$TESTDIR/file.txt
       58 +touch /$TESTDIR/file.txt
  59   59  
  60   60  
  61   61  # create a non-default property and a child we can use to test inherit
  62      -log_must $ZFS create $TESTPOOL/$TESTFS/$TESTFS2
  63      -log_must $ZFS set snapdir=hidden $TESTPOOL/$TESTFS
       62 +log_must zfs create $TESTPOOL/$TESTFS/$TESTFS2
       63 +log_must zfs set snapdir=hidden $TESTPOOL/$TESTFS
  64   64  
  65   65  
  66   66  # create an unmounted filesystem to test unmount
  67      -log_must $ZFS create $TESTPOOL/$TESTFS/$TESTFS2.unmounted
  68      -log_must $ZFS unmount $TESTPOOL/$TESTFS/$TESTFS2.unmounted
       67 +log_must zfs create $TESTPOOL/$TESTFS/$TESTFS2.unmounted
       68 +log_must zfs unmount $TESTPOOL/$TESTFS/$TESTFS2.unmounted
  69   69  
  70   70  
  71   71  # send our snapshot to a known file in /tmp
  72      -$ZFS send $TESTPOOL/$TESTFS@snap > /tmp/zfstest_datastream.dat
       72 +zfs send $TESTPOOL/$TESTFS@snap > /tmp/zfstest_datastream.dat
  73   73  if [ ! -s /tmp/zfstest_datastream.dat ]
  74   74  then
  75   75          log_fail "ZFS send datafile was not created!"
  76   76  fi
  77      -log_must $CHMOD 644 /tmp/zfstest_datastream.dat
       77 +log_must chmod 644 /tmp/zfstest_datastream.dat
  78   78  
  79   79  
  80   80  # create a filesystem that has particular properties to test set/get
  81      -log_must $ZFS create -o version=1 $TESTPOOL/$TESTFS/prop
       81 +log_must zfs create -o version=1 $TESTPOOL/$TESTFS/prop
  82   82  set -A props $PROP_NAMES
  83   83  set -A prop_vals $PROP_VALS
  84   84  typeset -i i=0
  85   85  
  86   86  while [[ $i -lt ${#props[*]} ]]
  87   87  do
  88   88          prop_name=${props[$i]}
  89   89          prop_val=${prop_vals[$i]}
  90      -        log_must $ZFS set $prop_name=$prop_val $TESTPOOL/$TESTFS/prop
       90 +        log_must zfs set $prop_name=$prop_val $TESTPOOL/$TESTFS/prop
  91   91          i=$(( $i + 1 ))
  92   92  done
  93   93  
  94   94  # create a filesystem we don't mind renaming
  95      -log_must $ZFS create $TESTPOOL/$TESTFS/renameme
       95 +log_must zfs create $TESTPOOL/$TESTFS/renameme
  96   96  
  97   97  
  98   98  if is_global_zone
  99   99  then
 100  100          # create a filesystem we can share
 101      -        log_must $ZFS create $TESTPOOL/$TESTFS/unshared
 102      -        log_must $ZFS set sharenfs=off $TESTPOOL/$TESTFS/unshared
      101 +        log_must zfs create $TESTPOOL/$TESTFS/unshared
      102 +        log_must zfs set sharenfs=off $TESTPOOL/$TESTFS/unshared
 103  103  
 104  104          # create a filesystem that we can unshare
 105      -        log_must $ZFS create $TESTPOOL/$TESTFS/shared
 106      -        log_must $ZFS set sharenfs=on $TESTPOOL/$TESTFS/shared
      105 +        log_must zfs create $TESTPOOL/$TESTFS/shared
      106 +        log_must zfs set sharenfs=on $TESTPOOL/$TESTFS/shared
 107  107  fi
 108  108  
 109  109  
 110      -log_must $ZFS create -o version=1 $TESTPOOL/$TESTFS/version1
 111      -log_must $ZFS create -o version=1 $TESTPOOL/$TESTFS/allowed
 112      -log_must $ZFS allow everyone create $TESTPOOL/$TESTFS/allowed
      110 +log_must zfs create -o version=1 $TESTPOOL/$TESTFS/version1
      111 +log_must zfs create -o version=1 $TESTPOOL/$TESTFS/allowed
      112 +log_must zfs allow everyone create $TESTPOOL/$TESTFS/allowed
 113  113  
 114  114  if is_global_zone
 115  115  then
 116  116  
 117  117          # Now create several virtual disks to test zpool with
 118  118  
 119      -        $MKFILE $MINVDEVSIZE /$TESTDIR/disk1.dat
 120      -        $MKFILE $MINVDEVSIZE /$TESTDIR/disk2.dat
 121      -        $MKFILE $MINVDEVSIZE /$TESTDIR/disk3.dat
 122      -        $MKFILE $MINVDEVSIZE /$TESTDIR/disk-additional.dat
 123      -        $MKFILE $MINVDEVSIZE /$TESTDIR/disk-export.dat
 124      -        $MKFILE $MINVDEVSIZE /$TESTDIR/disk-offline.dat
 125      -        $MKFILE $MINVDEVSIZE /$TESTDIR/disk-spare1.dat
 126      -        $MKFILE $MINVDEVSIZE /$TESTDIR/disk-spare2.dat
      119 +        mkfile $MINVDEVSIZE /$TESTDIR/disk1.dat
      120 +        mkfile $MINVDEVSIZE /$TESTDIR/disk2.dat
      121 +        mkfile $MINVDEVSIZE /$TESTDIR/disk3.dat
      122 +        mkfile $MINVDEVSIZE /$TESTDIR/disk-additional.dat
      123 +        mkfile $MINVDEVSIZE /$TESTDIR/disk-export.dat
      124 +        mkfile $MINVDEVSIZE /$TESTDIR/disk-offline.dat
      125 +        mkfile $MINVDEVSIZE /$TESTDIR/disk-spare1.dat
      126 +        mkfile $MINVDEVSIZE /$TESTDIR/disk-spare2.dat
 127  127  
 128  128          # and create a pool we can perform attach remove replace,
 129  129          # etc. operations with
 130      -        log_must $ZPOOL create $TESTPOOL.virt mirror /$TESTDIR/disk1.dat \
      130 +        log_must zpool create $TESTPOOL.virt mirror /$TESTDIR/disk1.dat \
 131  131          /$TESTDIR/disk2.dat /$TESTDIR/disk3.dat /$TESTDIR/disk-offline.dat \
 132  132          spare /$TESTDIR/disk-spare1.dat
 133  133  
 134  134  
 135  135          # Offline one of the disks to test online
 136      -        log_must $ZPOOL offline $TESTPOOL.virt /$TESTDIR/disk-offline.dat
      136 +        log_must zpool offline $TESTPOOL.virt /$TESTDIR/disk-offline.dat
 137  137  
 138  138  
 139  139          # create an exported pool to test import
 140      -        log_must $ZPOOL create $TESTPOOL.exported /$TESTDIR/disk-export.dat
 141      -        log_must $ZPOOL export $TESTPOOL.exported
      140 +        log_must zpool create $TESTPOOL.exported /$TESTDIR/disk-export.dat
      141 +        log_must zpool export $TESTPOOL.exported
 142  142  
 143  143          set -A props $POOL_PROPS
 144  144          set -A prop_vals $POOL_VALS
 145  145          typeset -i i=0
 146  146  
 147  147          while [[ $i -lt ${#props[*]} ]]
 148  148          do
 149  149                  prop_name=${props[$i]}
 150  150                  prop_val=${prop_vals[$i]}
 151      -                log_must $ZPOOL set $prop_name=$prop_val $TESTPOOL
      151 +                log_must zpool set $prop_name=$prop_val $TESTPOOL
 152  152                  i=$(( $i + 1 ))
 153  153          done
 154  154  
 155  155          # copy a v1 pool from cli_root
 156      -        $CP $STF_SUITE/tests/functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v1.dat.bz2 \
      156 +        cp $STF_SUITE/tests/functional/cli_root/zpool_upgrade/blockfiles/zfs-pool-v1.dat.bz2 \
 157  157              /$TESTDIR
 158      -        log_must $BUNZIP2 /$TESTDIR/zfs-pool-v1.dat.bz2
 159      -        log_must $ZPOOL import -d /$TESTDIR v1-pool
      158 +        log_must bunzip2 /$TESTDIR/zfs-pool-v1.dat.bz2
      159 +        log_must zpool import -d /$TESTDIR v1-pool
 160  160  fi
 161  161  log_pass
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX