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/inuse/inuse.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/inuse/inuse.cfg
*** 50,65 ****
#
# Essentailly this is the default_cleanup rountine but I cannot get it
# to work correctly. So its reproduced below. Still need to full
# understand why default_cleanup does not work correctly from here.
#
! log_must $ZFS umount $TESTPOOL/$TESTFS
! $RM -rf $TESTDIR || \
log_unresolved Could not remove $TESTDIR
! log_must $ZFS destroy $TESTPOOL/$TESTFS
destroy_pool $TESTPOOL
}
#
# Currently, if a ZFS disk gets formatted things go horribly wrong, hence the
# mini_format function. If the modify option is reached, then we know format
--- 50,65 ----
#
# Essentailly this is the default_cleanup rountine but I cannot get it
# to work correctly. So its reproduced below. Still need to full
# understand why default_cleanup does not work correctly from here.
#
! log_must zfs umount $TESTPOOL/$TESTFS
! rm -rf $TESTDIR || \
log_unresolved Could not remove $TESTDIR
! log_must zfs destroy $TESTPOOL/$TESTFS
destroy_pool $TESTPOOL
}
#
# Currently, if a ZFS disk gets formatted things go horribly wrong, hence the
# mini_format function. If the modify option is reached, then we know format
*** 68,92 ****
function mini_format
{
typeset disk=$1
typeset format_file=/var/tmp/format_in.$$.1
! $ECHO "partition" > $format_file
! $ECHO "modify" >> $format_file
! $FORMAT -e -s -d $disk -f $format_file
typeset -i retval=$?
! $RM -rf $format_file
return $retval
}
log_assert "format will disallow modification of a mounted zfs disk partition"\
" or a spare device"
log_onexit cleanup
log_must default_setup_noexit $FS_DISK0
! log_must $ZPOOL add $TESTPOOL spare $FS_DISK1
log_note "Attempt to format a ZFS disk"
log_mustnot mini_format $FS_DISK0
log_note "Attempt to format a ZFS spare device"
log_mustnot mini_format $FS_DISK1
--- 68,92 ----
function mini_format
{
typeset disk=$1
typeset format_file=/var/tmp/format_in.$$.1
! echo "partition" > $format_file
! echo "modify" >> $format_file
! format -e -s -d $disk -f $format_file
typeset -i retval=$?
! rm -rf $format_file
return $retval
}
log_assert "format will disallow modification of a mounted zfs disk partition"\
" or a spare device"
log_onexit cleanup
log_must default_setup_noexit $FS_DISK0
! log_must zpool add $TESTPOOL spare $FS_DISK1
log_note "Attempt to format a ZFS disk"
log_mustnot mini_format $FS_DISK0
log_note "Attempt to format a ZFS spare device"
log_mustnot mini_format $FS_DISK1