]> granicus.if.org Git - zfs/commitdiff
Update zfs destroy test scripts
authorcao <cao.xuewen@zte.com.cn>
Thu, 22 Sep 2016 22:28:34 +0000 (06:28 +0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 22 Sep 2016 22:28:34 +0000 (15:28 -0700)
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

tests/runfiles/linux.run
tests/zfs-tests/tests/functional/cli_root/zfs_destroy/cleanup.ksh
tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_008_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_009_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_010_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_011_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_012_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_013_neg.ksh
tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_common.kshlib

index 7d55a25a13189b7a2982895c6eefffd44d6678f7..7d8f4b51c81e88ee47a9995810b7277173fae08f 100644 (file)
@@ -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
index 90c0ac75f4d72652373b74dd1e6f8b6ab4b529c2..e838ba8a594749e9d414c6d82f7313acdae336b8 100755 (executable)
@@ -27,6 +27,4 @@
 
 . $STF_SUITE/tests/functional/cli_root/zfs_destroy/zfs_destroy_common.kshlib
 
-cleanup_testenv
-
 default_cleanup
index b9a866a3ff031a8adec0d996242c794335fe412b..3efc9c9754cb18e365c9b7a3977a2c21daa0c743 100755 (executable)
 #
 ################################################################################
 
+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"
index b602a3ec385190b431596b850b42c6b9db1e69e3..510776e6e1a6e723c3902ac96c07d9615463bc61 100755 (executable)
 #
 ################################################################################
 
-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"
index 150d0b3ead5520ddef094f8c8eb4b56fa1c984a2..77d9ed2f8bf8e7b4f54174eaebc511c0b6652984 100755 (executable)
 #
 ################################################################################
 
-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"
index 6039202ed21d49a0745993deeab9857706bf07db..b59fc9bdac2dc31b9880f0f19af649f95fe5fa08 100755 (executable)
 #
 ################################################################################
 
-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"
index 076e905159d51ce5e3482fa891f93935fb25b24d..d543f124b28aef29cdcbcee26db0a506682aa069 100755 (executable)
 #
 ################################################################################
 
-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"
index 198573d421a59c22d3e622e03ff89590ff7cb163..2a7ee209e143911ad530a9e458adcd7299da2ef5 100755 (executable)
 #
 ################################################################################
 
-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"
index ba3c9d4add0b0c49ee298c786132a716bc97bffc..41c1a4b56cc8c25177a6e071337d2ba68ca531e5 100644 (file)
@@ -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