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_012_pos.ksh
          +++ new/usr/src/test/zfs-tests/tests/functional/snapshot/snapshot_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 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 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' can create snapshot for promoted clone, and vice
  38   38  #       versa, a clone filesystem from the snapshot created by 'snapshot -r'
  39   39  #       can be correctly promoted.
↓ open down ↓ 7 lines elided ↑ open up ↑
  47   47  #       6. clone a snapshot from the snapshot tree
  48   48  #       7. promote the clone
  49   49  #       8. verify that the clone is promoted correctly.
  50   50  #
  51   51  
  52   52  verify_runnable "both"
  53   53  
  54   54  function cleanup
  55   55  {
  56   56          if datasetexists $clone1; then
  57      -                log_must $ZFS promote $ctrfs
  58      -                log_must $ZFS destroy $clone1
       57 +                log_must zfs promote $ctrfs
       58 +                log_must zfs destroy $clone1
  59   59          fi
  60   60  
  61   61          snapexists $snapctr && \
  62      -                log_must $ZFS destroy -r $snapctr
       62 +                log_must zfs destroy -r $snapctr
  63   63  
  64   64          if snapexists $clone@$TESTSNAP1; then
  65      -                log_must $ZFS promote $ctrfs
  66      -                log_must $ZFS destroy -rR $ctrfs@$TESTSNAP1
       65 +                log_must zfs promote $ctrfs
       66 +                log_must zfs destroy -rR $ctrfs@$TESTSNAP1
  67   67          fi
  68   68  }
  69   69  
  70   70  log_assert "Verify that 'snapshot -r' can work with 'zfs promote'."
  71   71  log_onexit cleanup
  72   72  
  73   73  ctr=$TESTPOOL/$TESTCTR
  74   74  ctrfs=$ctr/$TESTFS1
  75   75  clone=$ctr/$TESTCLONE
  76   76  clone1=$ctr/$TESTCLONE1
  77   77  snappool=$SNAPPOOL
  78   78  snapfs=$SNAPFS
  79   79  snapctr=$ctr@$TESTSNAP
  80   80  snapctrclone=$clone@$TESTSNAP
  81   81  snapctrclone1=$clone1@$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 $clone
  87      -log_must $ZFS promote $clone
       85 +log_must zfs snapshot $ctrfs@$TESTSNAP1
       86 +log_must zfs clone $ctrfs@$TESTSNAP1 $clone
       87 +log_must zfs promote $clone
  88   88  
  89      -log_must $ZFS snapshot -r $snapctr
       89 +log_must zfs snapshot -r $snapctr
  90   90  
  91   91  ! snapexists $snapctrclone && \
  92   92          log_fail "'snapshot -r' fails to create $snapctrclone for $ctr/$TESTCLONE."
  93   93  
  94      -log_must $ZFS clone $snapctrfs $clone1
  95      -log_must $ZFS promote $clone1
       94 +log_must zfs clone $snapctrfs $clone1
       95 +log_must zfs promote $clone1
  96   96  
  97   97  #verify the origin value is correct.
  98   98  orig_value=$(get_prop origin $ctrfs)
  99   99  if ! snapexists $snapctrclone1 || [[ "$orig_value" != "$snapctrclone1" ]]; then
 100  100          log_fail "'zfs promote' fails to promote $clone which is cloned from \
 101  101                  $snapctrfs."
 102  102  fi
 103  103  
 104  104  log_pass "'snapshot -r' can work with 'zfs promote' as expected."
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX