diff options
author | cao <[email protected]> | 2016-09-23 06:28:34 +0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-09-22 15:28:34 -0700 |
commit | 3ec68a4414ececbae227a508bcc7e236c358e64c (patch) | |
tree | 295ae89f9054970acfc8c31edd84e0182090bd92 /tests | |
parent | 160987b5762946a2d03fb608149fdc2224ec55d1 (diff) |
Update zfs destroy test scripts
Update and enable zfs_destroy_0[08-13]_*.ksh.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: cao.xuewen <[email protected]>
Closes #5068
Diffstat (limited to 'tests')
9 files changed, 111 insertions, 40 deletions
diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run index 7d55a25a1..7d8f4b51c 100644 --- a/tests/runfiles/linux.run +++ b/tests/runfiles/linux.run @@ -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 diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/cleanup.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/cleanup.ksh index 90c0ac75f..e838ba8a5 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/cleanup.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/cleanup.ksh @@ -27,6 +27,4 @@ . $STF_SUITE/tests/functional/cli_root/zfs_destroy/zfs_destroy_common.kshlib -cleanup_testenv - default_cleanup diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_008_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_008_pos.ksh index b9a866a3f..3efc9c975 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_008_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_008_pos.ksh @@ -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" diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_009_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_009_pos.ksh index b602a3ec3..510776e6e 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_009_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_009_pos.ksh @@ -41,12 +41,10 @@ # ################################################################################ -log_assert "'zfs destroy -d <snap>' marks cloned snapshot for deferred destroy" -log_onexit cleanup_testenv - -setup_testenv clone +function test_c_run +{ + typeset dstype=$1 -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" diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_010_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_010_pos.ksh index 150d0b3ea..77d9ed2f8 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_010_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_010_pos.ksh @@ -45,21 +45,33 @@ # ################################################################################ -log_assert "'zfs destroy -R' works on deferred destroyed snapshots" -log_onexit cleanup_testenv - -setup_testenv clone -log_must $UMOUNT -f $TESTDIR1 +function test_clone_run +{ + typeset dstype=$1 -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" diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_011_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_011_pos.ksh index 6039202ed..b59fc9bda 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_011_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_011_pos.ksh @@ -32,12 +32,10 @@ # ################################################################################ -log_assert "'zfs destroy -d <snap>' marks held snapshot for deferred destroy" -log_onexit cleanup_testenv - -setup_testenv snap +function test_snap_run +{ + typeset dstype=$1 -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" diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_012_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_012_pos.ksh index 076e90515..d543f124b 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_012_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_012_pos.ksh @@ -32,12 +32,10 @@ # ################################################################################ -log_assert "deferred destroyed snapshots remain until last hold is released" -log_onexit cleanup_testenv - -setup_testenv snap +function test_snap_run +{ + typeset dstype=$1 -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" diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_013_neg.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_013_neg.ksh index 198573d42..2a7ee209e 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_013_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_013_neg.ksh @@ -31,12 +31,10 @@ # ################################################################################ -log_assert "zfs destroy of held snapshots fails" -log_onexit cleanup_testenv - -setup_testenv snap +function test_snap_run +{ + typeset dstype=$1 -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" diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_common.kshlib b/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_common.kshlib index ba3c9d4ad..41c1a4b56 100644 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_common.kshlib +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_common.kshlib @@ -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 |