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 2007 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 2007 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
*** 47,63 ****
verify_runnable "both"
function cleanup
{
datasetexists $ctrfs && \
! $ZFS destroy -r $ctrfs
snapexists $snappool && \
! log_must $ZFS destroy -r $snappool
[[ -e $TESTDIR ]] && \
! log_must $RM -rf $TESTDIR/* > /dev/null 2>&1
}
log_assert "Verify snapshots from 'snapshot -r' can be used for zfs send/recv"
log_onexit cleanup
--- 47,63 ----
verify_runnable "both"
function cleanup
{
datasetexists $ctrfs && \
! zfs destroy -r $ctrfs
snapexists $snappool && \
! log_must zfs destroy -r $snappool
[[ -e $TESTDIR ]] && \
! log_must rm -rf $TESTDIR/* > /dev/null 2>&1
}
log_assert "Verify snapshots from 'snapshot -r' can be used for zfs send/recv"
log_onexit cleanup
*** 69,99 ****
snapctrfs=$ctrfs@$TESTSNAP
fsdir=/$ctrfs
snapdir=$fsdir/.zfs/snapshot/$TESTSNAP
[[ -n $TESTDIR ]] && \
! log_must $RM -rf $TESTDIR/* > /dev/null 2>&1
typeset -i COUNT=10
log_note "Populate the $TESTDIR directory (prior to snapshot)"
typeset -i i=0
while (( i < COUNT )); do
! log_must $FILE_WRITE -o create -f $TESTDIR/file$i \
-b $BLOCKSZ -c $NUM_WRITES -d $i
(( i = i + 1 ))
done
! log_must $ZFS snapshot -r $snappool
! $ZFS send $snapfs | $ZFS receive $ctrfs >/dev/null 2>&1
if ! datasetexists $ctrfs || ! snapexists $snapctrfs; then
log_fail "zfs send/receive fails with snapshot $snapfs."
fi
for dir in $fsdir $snapdir; do
! FILE_COUNT=`$LS -Al $dir | $GREP -v "total" | wc -l`
(( FILE_COUNT != COUNT )) && log_fail "Got $FILE_COUNT expected $COUNT"
done
log_pass "'zfs send/receive' works as expected with snapshots from 'snapshot -r'"
--- 69,99 ----
snapctrfs=$ctrfs@$TESTSNAP
fsdir=/$ctrfs
snapdir=$fsdir/.zfs/snapshot/$TESTSNAP
[[ -n $TESTDIR ]] && \
! log_must rm -rf $TESTDIR/* > /dev/null 2>&1
typeset -i COUNT=10
log_note "Populate the $TESTDIR directory (prior to snapshot)"
typeset -i i=0
while (( i < COUNT )); do
! log_must file_write -o create -f $TESTDIR/file$i \
-b $BLOCKSZ -c $NUM_WRITES -d $i
(( i = i + 1 ))
done
! log_must zfs snapshot -r $snappool
! zfs send $snapfs | zfs receive $ctrfs >/dev/null 2>&1
if ! datasetexists $ctrfs || ! snapexists $snapctrfs; then
log_fail "zfs send/receive fails with snapshot $snapfs."
fi
for dir in $fsdir $snapdir; do
! FILE_COUNT=`ls -Al $dir | grep -v "total" | wc -l`
(( FILE_COUNT != COUNT )) && log_fail "Got $FILE_COUNT expected $COUNT"
done
log_pass "'zfs send/receive' works as expected with snapshots from 'snapshot -r'"