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>

*** 24,34 **** # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ! # Copyright (c) 2013 by Delphix. All rights reserved. # . $STF_SUITE/include/libtest.shlib . $STF_SUITE/tests/functional/snapshot/snapshot.cfg --- 24,34 ---- # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ! # Copyright (c) 2013, 2016 by Delphix. All rights reserved. # . $STF_SUITE/include/libtest.shlib . $STF_SUITE/tests/functional/snapshot/snapshot.cfg
*** 60,71 **** "$SNAPFS2" "$SNAPDIR2" "$TESTPOOL1/$TESTCLONE2" "$TESTDIR.2" function setup_all { create_pool $TESTPOOL1 /dev/zvol/dsk/$TESTPOOL/$TESTVOL ! log_must $ZFS create $TESTPOOL1/$TESTFS ! log_must $ZFS set mountpoint=$TESTDIR2 $TESTPOOL1/$TESTFS return 0 } function cleanup_all --- 60,71 ---- "$SNAPFS2" "$SNAPDIR2" "$TESTPOOL1/$TESTCLONE2" "$TESTDIR.2" function setup_all { create_pool $TESTPOOL1 /dev/zvol/dsk/$TESTPOOL/$TESTVOL ! log_must zfs create $TESTPOOL1/$TESTFS ! log_must zfs set mountpoint=$TESTDIR2 $TESTPOOL1/$TESTFS return 0 } function cleanup_all
*** 73,100 **** typeset -i i=0 i=0 while (( i < ${#args[*]} )); do snapexists ${args[i]} && \ ! log_must $ZFS destroy -Rf ${args[i]} [[ -d ${args[i+3]} ]] && \ ! log_must $RM -rf ${args[i+3]} [[ -d ${args[i+1]} ]] && \ ! log_must $RM -rf ${args[i+1]} (( i = i + 4 )) done datasetexists $TESTPOOL1/$TESTFS && \ ! log_must $ZFS destroy -f $TESTPOOL1/$TESTFS destroy_pool $TESTPOOL1 [[ -d $TESTDIR2 ]] && \ ! log_must $RM -rf $TESTDIR2 return 0 } log_assert "Verify a cloned file system is writable." --- 73,100 ---- typeset -i i=0 i=0 while (( i < ${#args[*]} )); do snapexists ${args[i]} && \ ! log_must zfs destroy -Rf ${args[i]} [[ -d ${args[i+3]} ]] && \ ! log_must rm -rf ${args[i+3]} [[ -d ${args[i+1]} ]] && \ ! log_must rm -rf ${args[i+1]} (( i = i + 4 )) done datasetexists $TESTPOOL1/$TESTFS && \ ! log_must zfs destroy -f $TESTPOOL1/$TESTFS destroy_pool $TESTPOOL1 [[ -d $TESTDIR2 ]] && \ ! log_must rm -rf $TESTDIR2 return 0 } log_assert "Verify a cloned file system is writable."
*** 102,121 **** log_onexit cleanup_all setup_all [[ -n $TESTDIR ]] && \ ! log_must $RM -rf $TESTDIR/* > /dev/null 2>&1 typeset -i COUNT=10 typeset -i i=0 for mtpt in $TESTDIR $TESTDIR2 ; do log_note "Populate the $mtpt directory (prior to snapshot)" typeset -i j=1 while [[ $j -le $COUNT ]]; do ! log_must $FILE_WRITE -o create -f $mtpt/before_file$j \ -b $BLOCKSZ -c $NUM_WRITES -d $j (( j = j + 1 )) done done --- 102,121 ---- log_onexit cleanup_all setup_all [[ -n $TESTDIR ]] && \ ! log_must rm -rf $TESTDIR/* > /dev/null 2>&1 typeset -i COUNT=10 typeset -i i=0 for mtpt in $TESTDIR $TESTDIR2 ; do log_note "Populate the $mtpt directory (prior to snapshot)" typeset -i j=1 while [[ $j -le $COUNT ]]; do ! log_must file_write -o create -f $mtpt/before_file$j \ -b $BLOCKSZ -c $NUM_WRITES -d $j (( j = j + 1 )) done done
*** 122,158 **** while (( i < ${#args[*]} )); do # # Take a snapshot of the test file system. # ! log_must $ZFS snapshot ${args[i]} # # Clone a new file system from the snapshot # ! log_must $ZFS clone ${args[i]} ${args[i+2]} if [[ -n ${args[i+3]} ]] ; then ! log_must $ZFS set mountpoint=${args[i+3]} ${args[i+2]} ! FILE_COUNT=`$LS -Al ${args[i+3]} | $GREP -v "total" \ ! | $GREP -v "\.zfs" | wc -l` if [[ $FILE_COUNT -ne $COUNT ]]; then ! $LS -Al ${args[i+3]} log_fail "AFTER: ${args[i+3]} contains $FILE_COUNT files(s)." fi log_note "Verify the ${args[i+3]} directory is writable" j=1 while [[ $j -le $COUNT ]]; do ! log_must $FILE_WRITE -o create -f ${args[i+3]}/after_file$j \ -b $BLOCKSZ -c $NUM_WRITES -d $j (( j = j + 1 )) done ! FILE_COUNT=`$LS -Al ${args[i+3]}/after* | $GREP -v "total" | wc -l` if [[ $FILE_COUNT -ne $COUNT ]]; then ! $LS -Al ${args[i+3]} log_fail "${args[i+3]} contains $FILE_COUNT after* files(s)." fi fi (( i = i + 4 )) --- 122,158 ---- while (( i < ${#args[*]} )); do # # Take a snapshot of the test file system. # ! log_must zfs snapshot ${args[i]} # # Clone a new file system from the snapshot # ! log_must zfs clone ${args[i]} ${args[i+2]} if [[ -n ${args[i+3]} ]] ; then ! log_must zfs set mountpoint=${args[i+3]} ${args[i+2]} ! FILE_COUNT=`ls -Al ${args[i+3]} | grep -v "total" \ ! | grep -v "\.zfs" | wc -l` if [[ $FILE_COUNT -ne $COUNT ]]; then ! ls -Al ${args[i+3]} log_fail "AFTER: ${args[i+3]} contains $FILE_COUNT files(s)." fi log_note "Verify the ${args[i+3]} directory is writable" j=1 while [[ $j -le $COUNT ]]; do ! log_must file_write -o create -f ${args[i+3]}/after_file$j \ -b $BLOCKSZ -c $NUM_WRITES -d $j (( j = j + 1 )) done ! FILE_COUNT=`ls -Al ${args[i+3]}/after* | grep -v "total" | wc -l` if [[ $FILE_COUNT -ne $COUNT ]]; then ! ls -Al ${args[i+3]} log_fail "${args[i+3]} contains $FILE_COUNT after* files(s)." fi fi (( i = i + 4 ))