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 <liu.huang@zte.com.cn>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #5000
This commit is contained in:
liuhuang 2016-08-22 07:40:54 +08:00 committed by Brian Behlendorf
parent 8f50bafb04
commit 2158b165ed
3 changed files with 30 additions and 17 deletions

View File

@ -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',

View File

@ -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 )) || \
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 || \
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."

View File

@ -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."