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/snapshot/snapshot_009_pos.ksh
          +++ new/usr/src/test/zfs-tests/tests/functional/snapshot/snapshot_009_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 2007 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/include/libtest.shlib
  33   33  . $STF_SUITE/tests/functional/snapshot/snapshot.cfg
  34   34  
  35   35  #
  36   36  # DESCRIPTION:
  37   37  #       Verify 'snapshot -r' and 'destroy -r' can correctly create and destroy
  38   38  #       snapshot tree respectively.
  39   39  #
↓ open down ↓ 6 lines elided ↑ open up ↑
  46   46  
  47   47  verify_runnable "both"
  48   48  
  49   49  function cleanup
  50   50  {
  51   51          typeset ds
  52   52          typeset snap
  53   53  
  54   54          for ds in $ctr/$TESTVOL1 $ctr/$TESTCLONE; do
  55   55                  datasetexists $ds && \
  56      -                        log_must $ZFS destroy -f $ds
       56 +                        log_must zfs destroy -f $ds
  57   57          done
  58   58  
  59   59          for snap in $ctr/$TESTFS1@$TESTSNAP1 \
  60   60                  $snappool $snapvol $snapctr $snapctrvol \
  61   61                  $snapctrclone $snapctrfs
  62   62          do
  63   63                  snapexists $snap && \
  64      -                        log_must $ZFS destroy -rf $snap
       64 +                        log_must zfs destroy -rf $snap
  65   65          done
  66   66  
  67   67  }
  68   68  
  69   69  log_assert "Verify snapshot -r can correctly create a snapshot tree."
  70   70  log_onexit cleanup
  71   71  
  72   72  ctr=$TESTPOOL/$TESTCTR
  73   73  ctrfs=$ctr/$TESTFS1
  74   74  ctrclone=$ctr/$TESTCLONE
  75   75  ctrvol=$ctr/$TESTVOL1
  76   76  snappool=$SNAPPOOL
  77   77  snapfs=$SNAPFS
  78   78  snapctr=$ctr@$TESTSNAP
  79   79  snapvol=$SNAPFS1
  80   80  snapctrvol=$ctrvol@$TESTSNAP
  81   81  snapctrclone=$ctrclone@$TESTSNAP
  82   82  snapctrfs=$SNAPCTR
  83   83  
  84   84  #preparation for testing
  85      -log_must $ZFS snapshot $ctrfs@$TESTSNAP1
  86      -log_must $ZFS clone $ctrfs@$TESTSNAP1 $ctrclone
       85 +log_must zfs snapshot $ctrfs@$TESTSNAP1
       86 +log_must zfs clone $ctrfs@$TESTSNAP1 $ctrclone
  87   87  if is_global_zone; then
  88      -        log_must $ZFS create -V $VOLSIZE $ctrvol
       88 +        log_must zfs create -V $VOLSIZE $ctrvol
  89   89  else
  90      -        log_must $ZFS create $ctrvol
       90 +        log_must zfs create $ctrvol
  91   91  fi
  92   92  
  93      -log_must $ZFS snapshot -r $snappool
       93 +log_must zfs snapshot -r $snappool
  94   94  
  95   95  #verify the snapshot -r results
  96   96  for snap in $snappool $snapfs $snapvol $snapctr $snapctrvol \
  97   97                  $snapctrclone $snapctrfs
  98   98  do
  99   99          ! snapexists $snap && \
 100  100                  log_fail "The snapshot $snap is not created via -r option."
 101  101  done
 102  102  
 103  103  log_note "Verify that destroy -r can destroy the snapshot tree."
 104  104  
 105      -log_must $ZFS destroy -r $snappool
      105 +log_must zfs destroy -r $snappool
 106  106  for snap in $snappool $snapfs $snapvol $snapctr $snapctrvol \
 107  107                  $snapctrclone $snapctrfs
 108  108  do
 109  109          snapexists $snap && \
 110  110                  log_fail "The snapshot $snap is not destroyed correctly."
 111  111  done
 112  112  
 113  113  log_note "Verify that the snapshot with different name should \
 114  114                  be not destroyed."
 115  115  ! snapexists $ctrfs@$TESTSNAP1 && \
 116  116          log_fail "destroy -r incorrectly destroys the snapshot \
 117  117                  $ctrfs@$TESTSNAP1."
 118  118  
 119  119  log_pass  "snapshot|destroy -r with snapshot tree works as expected."
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX