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_005_pos.ksh
          +++ new/usr/src/test/zfs-tests/tests/functional/snapshot/snapshot_005_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  # to the originally snapshot'd file system, after the file
  38   38  # system has been changed. Uses 'sum -r'.
  39   39  #
↓ open down ↓ 4 lines elided ↑ open up ↑
  44   44  # 4) Append to the original file
  45   45  # 5) Verify both checksums match
  46   46  #
  47   47  
  48   48  verify_runnable "both"
  49   49  
  50   50  function cleanup
  51   51  {
  52   52          snapexists $SNAPCTR
  53   53          if [[ $? -eq 0 ]]; then
  54      -                log_must $ZFS destroy $SNAPCTR
       54 +                log_must zfs destroy $SNAPCTR
  55   55          fi
  56   56  
  57   57          if [[ -e $SNAPDIR1 ]]; then
  58      -                log_must $RM -rf $SNAPDIR1 > /dev/null 2>&1
       58 +                log_must rm -rf $SNAPDIR1 > /dev/null 2>&1
  59   59          fi
  60   60  
  61   61          if [[ -e $TESTDIR ]]; then
  62      -                log_must $RM -rf $TESTDIR/* > /dev/null 2>&1
       62 +                log_must rm -rf $TESTDIR/* > /dev/null 2>&1
  63   63          fi
  64   64  }
  65   65  
  66   66  log_assert "Verify that a snapshot of a dataset is identical to " \
  67   67      "the original dataset."
  68   68  log_onexit cleanup
  69   69  
  70   70  log_note "Create a file in the zfs filesystem..."
  71      -log_must $FILE_WRITE -o create -f $TESTDIR1/$TESTFILE -b $BLOCKSZ \
       71 +log_must file_write -o create -f $TESTDIR1/$TESTFILE -b $BLOCKSZ \
  72   72      -c $NUM_WRITES -d $DATA
  73   73  
  74   74  log_note "Sum the file, save for later comparison..."
  75      -FILE_SUM=`$SUM -r $TESTDIR1/$TESTFILE | $AWK  '{ print $1 }'`
       75 +FILE_SUM=`sum -r $TESTDIR1/$TESTFILE | awk  '{ print $1 }'`
  76   76  log_note "FILE_SUM = $FILE_SUM"
  77   77  
  78   78  log_note "Create a snapshot and mount it..."
  79      -log_must $ZFS snapshot $SNAPCTR
       79 +log_must zfs snapshot $SNAPCTR
  80   80  
  81   81  log_note "Append to the original file..."
  82      -log_must $FILE_WRITE -o append -f $TESTDIR1/$TESTFILE -b $BLOCKSZ \
       82 +log_must file_write -o append -f $TESTDIR1/$TESTFILE -b $BLOCKSZ \
  83   83      -c $NUM_WRITES -d $DATA
  84   84  
  85      -SNAP_FILE_SUM=`$SUM -r $SNAPDIR1/$TESTFILE | $AWK '{ print $1 }'`
       85 +SNAP_FILE_SUM=`sum -r $SNAPDIR1/$TESTFILE | awk '{ print $1 }'`
  86   86  if [[ $SNAP_FILE_SUM -ne $FILE_SUM ]]; then
  87   87          log_fail "Sums do not match, aborting!! ($SNAP_FILE_SUM != $FILE_SUM)"
  88   88  fi
  89   89  
  90   90  log_pass "Both Sums match. ($SNAP_FILE_SUM == $FILE_SUM)"
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX