Update zfs destroy test scripts
Update and enable zfs_destroy_0[08-13]_*.ksh. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: cao.xuewen <cao.xuewen@zte.com.cn> Closes #5068
This commit is contained in:
parent
160987b576
commit
3ec68a4414
|
@ -96,16 +96,12 @@ tests = ['zfs_create_001_pos', 'zfs_create_002_pos', 'zfs_create_003_pos',
|
|||
|
||||
# DISABLED:
|
||||
# zfs_destroy_005_neg - busy mountpoint behavior
|
||||
# zfs_destroy_008_pos - busy mountpoint behavior
|
||||
# zfs_destroy_009_pos - busy mountpoint behavior
|
||||
# zfs_destroy_010_pos - busy mountpoint behavior
|
||||
# zfs_destroy_011_pos - busy mountpoint behavior
|
||||
# zfs_destroy_012_pos - busy mountpoint behavior
|
||||
# zfs_destroy_013_neg - busy mountpoint behavior
|
||||
[tests/functional/cli_root/zfs_destroy]
|
||||
tests = ['zfs_destroy_001_pos', 'zfs_destroy_002_pos', 'zfs_destroy_003_pos',
|
||||
'zfs_destroy_004_pos', 'zfs_destroy_006_neg', 'zfs_destroy_007_neg',
|
||||
'zfs_destroy_014_pos', 'zfs_destroy_015_pos', 'zfs_destroy_016_pos']
|
||||
'zfs_destroy_004_pos','zfs_destroy_006_neg', 'zfs_destroy_007_neg',
|
||||
'zfs_destroy_008_pos','zfs_destroy_009_pos', 'zfs_destroy_010_pos',
|
||||
'zfs_destroy_011_pos','zfs_destroy_012_pos', 'zfs_destroy_013_neg',
|
||||
'zfs_destroy_014_pos','zfs_destroy_015_pos', 'zfs_destroy_016_pos']
|
||||
|
||||
# DISABLED:
|
||||
# zfs_get_004_pos - nested pools
|
||||
|
|
|
@ -27,6 +27,4 @@
|
|||
|
||||
. $STF_SUITE/tests/functional/cli_root/zfs_destroy/zfs_destroy_common.kshlib
|
||||
|
||||
cleanup_testenv
|
||||
|
||||
default_cleanup
|
||||
|
|
|
@ -38,14 +38,27 @@
|
|||
#
|
||||
################################################################################
|
||||
|
||||
function test_s_run
|
||||
{
|
||||
typeset snap=$1
|
||||
|
||||
log_must $ZFS destroy -d $snap
|
||||
log_mustnot datasetexists $snap
|
||||
}
|
||||
|
||||
log_assert "'zfs destroy -d <snap>' destroys snapshot if there is no clone"
|
||||
log_onexit cleanup_testenv
|
||||
|
||||
setup_testenv snap
|
||||
|
||||
for snap in $FSSNAP $VOLSNAP; do
|
||||
log_must $ZFS destroy -d $snap
|
||||
log_mustnot datasetexists $snap
|
||||
if [[ $snap == $VOLSNAP ]]; then
|
||||
if is_global_zone; then
|
||||
test_s_run $snap
|
||||
fi
|
||||
else
|
||||
test_s_run $snap
|
||||
fi
|
||||
done
|
||||
|
||||
log_pass "'zfs destroy -d <snap>' destroys snapshot if there is no clone"
|
||||
|
|
|
@ -41,12 +41,10 @@
|
|||
#
|
||||
################################################################################
|
||||
|
||||
log_assert "'zfs destroy -d <snap>' marks cloned snapshot for deferred destroy"
|
||||
log_onexit cleanup_testenv
|
||||
function test_c_run
|
||||
{
|
||||
typeset dstype=$1
|
||||
|
||||
setup_testenv clone
|
||||
|
||||
for dstype in FS VOL; do
|
||||
snap=$(eval echo \$${dstype}SNAP)
|
||||
clone=$(eval echo \$${dstype}CLONE)
|
||||
log_must $ZFS destroy -d $snap
|
||||
|
@ -55,6 +53,21 @@ for dstype in FS VOL; do
|
|||
log_must $ZFS destroy $clone
|
||||
log_mustnot datasetexists $snap
|
||||
log_mustnot datasetexists $clone
|
||||
}
|
||||
|
||||
log_assert "'zfs destroy -d <snap>' marks cloned snapshot for deferred destroy"
|
||||
log_onexit cleanup_testenv
|
||||
|
||||
setup_testenv clone
|
||||
|
||||
for dstype in FS VOL; do
|
||||
if [[ $dstype == VOL ]]; then
|
||||
if is_global_zone; then
|
||||
test_c_run $dstype
|
||||
fi
|
||||
else
|
||||
test_c_run $dstype
|
||||
fi
|
||||
done
|
||||
|
||||
log_pass "'zfs destroy -d <snap>' marks cloned snapshot for deferred destroy"
|
||||
|
|
|
@ -45,21 +45,33 @@
|
|||
#
|
||||
################################################################################
|
||||
|
||||
log_assert "'zfs destroy -R' works on deferred destroyed snapshots"
|
||||
log_onexit cleanup_testenv
|
||||
function test_clone_run
|
||||
{
|
||||
typeset dstype=$1
|
||||
|
||||
setup_testenv clone
|
||||
log_must $UMOUNT -f $TESTDIR1
|
||||
|
||||
for dstype in FS VOL; do
|
||||
ds=$(eval echo \$${dstype})
|
||||
snap=$(eval echo \$${dstype}SNAP)
|
||||
clone=$(eval echo \$${dstype}CLONE)
|
||||
log_must $ZFS destroy -d $snap
|
||||
log_must datasetexists $snap
|
||||
log_must $ZFS destroy -R $ds
|
||||
log_must $ZFS destroy -R $clone
|
||||
log_mustnot datasetexists $snap
|
||||
log_mustnot datasetexists $clone
|
||||
}
|
||||
|
||||
log_assert "'zfs destroy -R' works on deferred destroyed snapshots"
|
||||
log_onexit cleanup_testenv
|
||||
|
||||
setup_testenv clone
|
||||
|
||||
for dstype in FS VOL; do
|
||||
if [[ $dstype == VOL ]]; then
|
||||
if is_global_zone; then
|
||||
test_clone_run $dstype
|
||||
fi
|
||||
else
|
||||
test_clone_run $dstype
|
||||
fi
|
||||
done
|
||||
|
||||
log_pass "'zfs destroy -R' works on deferred destroyed snapshots"
|
||||
|
|
|
@ -32,12 +32,10 @@
|
|||
#
|
||||
################################################################################
|
||||
|
||||
log_assert "'zfs destroy -d <snap>' marks held snapshot for deferred destroy"
|
||||
log_onexit cleanup_testenv
|
||||
function test_snap_run
|
||||
{
|
||||
typeset dstype=$1
|
||||
|
||||
setup_testenv snap
|
||||
|
||||
for dstype in FS VOL; do
|
||||
snap=$(eval echo \$${dstype}SNAP)
|
||||
log_must $ZFS hold zfstest $snap
|
||||
log_must $ZFS destroy -d $snap
|
||||
|
@ -45,6 +43,21 @@ for dstype in FS VOL; do
|
|||
log_must eval "[[ $(get_prop defer_destroy $snap) == 'on' ]]"
|
||||
log_must $ZFS release zfstest $snap
|
||||
log_mustnot datasetexists $snap
|
||||
}
|
||||
|
||||
log_assert "'zfs destroy -d <snap>' marks held snapshot for deferred destroy"
|
||||
log_onexit cleanup_testenv
|
||||
|
||||
setup_testenv snap
|
||||
|
||||
for dstype in FS VOL; do
|
||||
if [[ $dstype == VOL ]]; then
|
||||
if is_global_zone; then
|
||||
test_snap_run $dstype
|
||||
fi
|
||||
else
|
||||
test_snap_run $dstype
|
||||
fi
|
||||
done
|
||||
|
||||
log_pass "'zfs destroy -d <snap>' marks held snapshot for deferred destroy"
|
||||
|
|
|
@ -32,12 +32,10 @@
|
|||
#
|
||||
################################################################################
|
||||
|
||||
log_assert "deferred destroyed snapshots remain until last hold is released"
|
||||
log_onexit cleanup_testenv
|
||||
function test_snap_run
|
||||
{
|
||||
typeset dstype=$1
|
||||
|
||||
setup_testenv snap
|
||||
|
||||
for dstype in FS VOL; do
|
||||
snap=$(eval echo \$${dstype}SNAP)
|
||||
log_must $ZFS hold zfstest1 $snap
|
||||
log_must $ZFS destroy -d $snap
|
||||
|
@ -57,6 +55,21 @@ for dstype in FS VOL; do
|
|||
|
||||
log_must $ZFS release zfstest2 $snap
|
||||
log_mustnot datasetexists $snap
|
||||
}
|
||||
|
||||
log_assert "deferred destroyed snapshots remain until last hold is released"
|
||||
log_onexit cleanup_testenv
|
||||
|
||||
setup_testenv snap
|
||||
|
||||
for dstype in FS VOL; do
|
||||
if [[ $dstype == VOL ]]; then
|
||||
if is_global_zone; then
|
||||
test_snap_run $dstype
|
||||
fi
|
||||
else
|
||||
test_snap_run $dstype
|
||||
fi
|
||||
done
|
||||
|
||||
log_pass "deferred destroyed snapshots remain until last hold is released"
|
||||
|
|
|
@ -31,12 +31,10 @@
|
|||
#
|
||||
################################################################################
|
||||
|
||||
log_assert "zfs destroy of held snapshots fails"
|
||||
log_onexit cleanup_testenv
|
||||
function test_snap_run
|
||||
{
|
||||
typeset dstype=$1
|
||||
|
||||
setup_testenv snap
|
||||
|
||||
for dstype in FS VOL; do
|
||||
snap=$(eval echo \$${dstype}SNAP)
|
||||
log_must $ZFS hold zfstest $snap
|
||||
log_mustnot $ZFS destroy $snap
|
||||
|
@ -44,6 +42,21 @@ for dstype in FS VOL; do
|
|||
log_must $ZFS release zfstest $snap
|
||||
log_must $ZFS destroy $snap
|
||||
log_mustnot datasetexists $snap
|
||||
}
|
||||
|
||||
log_assert "zfs destroy of held snapshots fails"
|
||||
log_onexit cleanup_testenv
|
||||
|
||||
setup_testenv snap
|
||||
|
||||
for dstype in FS VOL; do
|
||||
if [[ $dstype == VOL ]]; then
|
||||
if is_global_zone; then
|
||||
test_snap_run $dstype
|
||||
fi
|
||||
else
|
||||
test_snap_run $dstype
|
||||
fi
|
||||
done
|
||||
|
||||
log_pass "zfs destroy of held snapshots fails"
|
||||
|
|
|
@ -97,7 +97,7 @@ function setup_testenv #[dtst]
|
|||
#
|
||||
function cleanup_testenv
|
||||
{
|
||||
if is_global_zone && ismounted "$TESTDIR1" "ufs" ; then
|
||||
if is_global_zone && ismounted "$TESTDIR1" "$NEWFS_DEFAULT_FS" ; then
|
||||
log_must $UMOUNT -f $TESTDIR1
|
||||
fi
|
||||
if [[ -d $TESTDIR1 ]]; then
|
||||
|
|
Loading…
Reference in New Issue