aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorliuhuang <[email protected]>2016-08-22 07:40:54 +0800
committerBrian Behlendorf <[email protected]>2016-08-30 15:24:18 -0700
commit2158b165ed02178a58540b55eca828d32977147c (patch)
treea6179f36a6fde7286c206720c2ff90cf68e9984b /tests
parent8f50bafb04658911a1c2a6be3a969b726cc527c4 (diff)
Update zfs_mount_005_pos.ksh and zfs_mount_010_neg.ksh
Update zfs_mount_005_pos.ksh and zfs_mount_010_neg.ksh to reflect the expected Linux behavior. The is_linux wrapper is used so the test case may be used on Linux and non-Linux platforms. Signed-off-by: liuhuang <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #5000
Diffstat (limited to 'tests')
-rw-r--r--tests/runfiles/linux.run6
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_005_pos.ksh31
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_010_neg.ksh10
3 files changed, 30 insertions, 17 deletions
diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run
index 42a82e4b3..f68a6f44d 100644
--- a/tests/runfiles/linux.run
+++ b/tests/runfiles/linux.run
@@ -124,16 +124,14 @@ tests = ['zfs_get_001_pos', 'zfs_get_002_pos', 'zfs_get_003_pos',
tests = ['zfs_inherit_001_neg', 'zfs_inherit_002_neg', 'zfs_inherit_003_pos']
# DISABLED:
-# zfs_mount_005_pos - needs investigation
# zfs_mount_006_pos - needs investigation
# zfs_mount_007_pos - needs investigation
# zfs_mount_009_neg - needs investigation
-# zfs_mount_010_neg - needs investigation
# zfs_mount_all_001_pos - needs investigation
[tests/functional/cli_root/zfs_mount]
tests = ['zfs_mount_001_pos', 'zfs_mount_002_pos', 'zfs_mount_003_pos',
- 'zfs_mount_004_pos', 'zfs_mount_008_pos',
- 'zfs_mount_011_neg']
+ 'zfs_mount_004_pos', 'zfs_mount_005_pos', 'zfs_mount_008_pos',
+ 'zfs_mount_010_neg', 'zfs_mount_011_neg']
[tests/functional/cli_root/zfs_promote]
tests = ['zfs_promote_001_pos', 'zfs_promote_002_pos', 'zfs_promote_003_pos',
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_005_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_005_pos.ksh
index 1e5610434..7e9f13834 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_005_pos.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_005_pos.ksh
@@ -30,17 +30,17 @@
#
# DESCRIPTION:
-# Invoke "zfs mount <filesystem>" with a filesystem
-# but its mountpoint is currently in use,
-# it will fail with a return code of 1
-# and issue an error message.
+# Invoke "zfs mount <filesystem>" with a filesystem but its mountpoint
+# is currently in use. Under Linux this should succeed and is the
+# expected behavior, it will fail with a return code of 1 and issue
+# an error message on other platforms.
#
# STRATEGY:
# 1. Make sure that the ZFS filesystem is unmounted.
# 2. Apply 'zfs set mountpoint=path <filesystem>'.
# 3. Change directory to that given mountpoint.
# 3. Invoke 'zfs mount <filesystem>'.
-# 4. Verify that mount failed with return code of 1.
+# 4. Verify that mount succeeds on Linux and fails for other platforms.
#
verify_runnable "both"
@@ -70,13 +70,24 @@ cd $TESTDIR || \
$ZFS $mountcmd $TESTPOOL/$TESTFS
ret=$?
-(( ret == 1 )) || \
- log_fail "'$ZFS $mountcmd $TESTPOOL/$TESTFS' " \
- "unexpected return code of $ret."
+if is_linux; then
+ (( ret == 0 )) || \
+ log_fail "'$ZFS $mountcmd $TESTPOOL/$TESTFS' " \
+ "unexpected return code of $ret."
+else
+ (( ret == 1 )) || \
+ log_fail "'$ZFS $mountcmd $TESTPOOL/$TESTFS' " \
+ "unexpected return code of $ret."
+fi
log_note "Make sure the filesystem $TESTPOOL/$TESTFS is unmounted"
-unmounted $TESTPOOL/$TESTFS || \
- log_fail Filesystem $TESTPOOL/$TESTFS is mounted
+if is_linux; then
+ mounted $TESTPOOL/$TESTFS || \
+ log_fail Filesystem $TESTPOOL/$TESTFS is unmounted
+else
+ unmounted $TESTPOOL/$TESTFS || \
+ log_fail Filesystem $TESTPOOL/$TESTFS is mounted
+fi
log_pass "'$ZFS $mountcmd' with a filesystem " \
"whose mountpoint is currently in use failed with return code 1."
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_010_neg.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_010_neg.ksh
index f4cb32163..b6ab6d8f2 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_010_neg.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_010_neg.ksh
@@ -30,12 +30,12 @@
#
# DESCRIPTION:
# Verify that zfs mount should fail when mounting a mounted zfs filesystem or
-# the mountpoint is busy
+# the mountpoint is busy. On Linux the mount should succeed.
#
# STRATEGY:
# 1. Make a zfs filesystem mounted or mountpoint busy
# 2. Use zfs mount to mount the filesystem
-# 3. Verify that zfs mount returns error
+# 3. Verify that zfs mount succeeds on Linux and fails for other platforms
#
verify_runnable "both"
@@ -61,7 +61,11 @@ mpt=$(get_prop mountpoint $fs)
log_must $ZFS umount $fs
curpath=`$DIRNAME $0`
cd $mpt
-log_mustnot $ZFS mount $fs
+if is_linux; then
+ log_must $ZFS mount $fs
+else
+ log_mustnot $ZFS mount $fs
+fi
cd $curpath
log_pass "zfs mount fails with mounted filesystem or busy moutpoint as expected."