Enable mountpoint_003_pos

Update the test case to correctly interpret how Linux reports
the mount options.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: ChaoyuZhang <zhang.chaoyu@zte.com.cn>
Closes #5410
This commit is contained in:
ChaoyuZhang 2016-12-03 02:20:57 +08:00 committed by Brian Behlendorf
parent 4dec26e49a
commit 6c09d3e5a0
2 changed files with 33 additions and 21 deletions

View File

@ -167,8 +167,6 @@ tests = ['zfs_send_001_pos', 'zfs_send_002_pos', 'zfs_send_003_pos',
'zfs_send_004_neg', 'zfs_send_005_pos', 'zfs_send_006_pos',
'zfs_send_007_pos']
# DISABLED:
# mountpoint_003_pos - needs investigation
[tests/functional/cli_root/zfs_set]
tests = ['cache_001_pos', 'cache_002_neg', 'canmount_001_pos',
'canmount_002_pos', 'canmount_003_pos', 'canmount_004_pos',
@ -178,7 +176,7 @@ tests = ['cache_001_pos', 'cache_002_neg', 'canmount_001_pos',
'user_property_001_pos', 'user_property_003_neg', 'readonly_001_pos',
'user_property_004_pos', 'version_001_neg', 'zfs_set_001_neg',
'zfs_set_002_neg', 'zfs_set_003_neg', 'property_alias_001_pos',
'ro_props_001_pos']
'ro_props_001_pos', 'mountpoint_003_pos']
# DISABLED: Tests need to be updated for Linux share behavior
# zfs_share_005_pos - needs investigation, probably unsupported NFS share format

View File

@ -61,13 +61,13 @@ log_onexit cleanup
#
if is_linux; then
set -A args \
"dev" "/dev/" "nodev" "/nodev/" \
"exec" "/exec/" "noexec" "/noexec/" \
"mand" "/mand/" "nomand" "/nomand/" \
"ro" "read only" "rw" "read/write" \
"suid" "/suid/" "nosuid" "/nosuid/" \
"xattr" "/xattr/" "noxattr" "/noxattr/" \
"atime" "/atime/" "noatime" "/noatime/"
"nodev" "dev" \
"noexec" "exec" \
"mand" "nomand" \
"ro" "rw" \
"nosuid" "suid" \
"xattr" "noxattr" \
"atime" "noatime"
else
set -A args \
"devices" "/devices/" "nodevices" "/nodevices/" \
@ -90,26 +90,40 @@ typeset i=0
while ((i < ${#args[@]})); do
if is_linux; then
log_must $MOUNT -t zfs -o ${args[$i]} $testfs $tmpmnt
msg=$($MOUNT | $GREP "$tmpmnt ")
$ECHO $msg | $GREP "${args[((i))]}" > /dev/null 2>&1
if (($? != 0)) ; then
$ECHO $msg | $GREP "${args[((i-1))]}" > /dev/null 2>&1
if (($? == 0)) ; then
log_fail "Expected option: ${args[((i))]} \n" \
"Real option: $msg"
fi
fi
log_must $UMOUNT $tmpmnt
((i += 1))
else
log_must $MOUNT -F zfs -o ${args[$i]} $testfs $tmpmnt
fi
msg=$($MOUNT | $GREP "^$tmpmnt ")
if ! is_linux; then
msg=$($MOUNT | $GREP "^$tmpmnt ")
# In LZ, a user with all zone privileges can never "devices"
if ! is_global_zone && [[ ${args[$i]} == devices ]] ; then
args[((i+1))]="/nodevices/"
fi
fi
$ECHO $msg | $GREP "${args[((i+1))]}" > /dev/null 2>&1
if (($? != 0)) ; then
log_fail "Expected option: ${args[((i+1))]} \n" \
"Real option: $msg"
fi
$ECHO $msg | $GREP "${args[((i+1))]}" > /dev/null 2>&1
if (($? != 0)) ; then
log_fail "Expected option: ${args[((i+1))]} \n" \
"Real option: $msg"
fi
log_must $UMOUNT $tmpmnt
((i += 2))
log_must $UMOUNT $tmpmnt
((i += 2))
fi
done
log_pass "With legacy mount, FSType-specific option works well passed."