summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGiuseppe Di Natale <[email protected]>2017-07-24 11:03:50 -0700
committerBrian Behlendorf <[email protected]>2017-07-24 11:03:50 -0700
commit0c656a964da7993847943c438c5abee7f46aa06d (patch)
treeebc55bcc94def191787b1db92bd5f79aab620211 /tests
parentc89a02a26ae8f314c621ffd5542a3502a196b7d0 (diff)
Disable nbmand tests on kernels w/o support
This change allows mountpoint_003_pos and send-c_props to run on Linux kernels that do not support mandatory locking. Linux kernel versions greater than or equal to 4.4 no longer support mandatory locking and the test suite will now account for that. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: George Melikov <[email protected]> Signed-off-by: Giuseppe Di Natale <[email protected]> Closes #6346 Closes #6347 Closes #6362
Diffstat (limited to 'tests')
-rw-r--r--tests/zfs-tests/include/libtest.shlib23
-rw-r--r--tests/zfs-tests/include/properties.shlib13
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zfs_set/mountpoint_003_pos.ksh6
3 files changed, 39 insertions, 3 deletions
diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib
index 1d1c57e7a..88594c201 100644
--- a/tests/zfs-tests/include/libtest.shlib
+++ b/tests/zfs-tests/include/libtest.shlib
@@ -40,6 +40,29 @@ if [ -n "$STF_PATH" ]; then
PATH="$STF_PATH"
fi
+# Linux kernel version comparison function
+#
+# $1 Linux version ("4.10", "2.6.32") or blank for installed Linux version
+#
+# Used for comparison: if [ $(linux_version) -ge $(linux_version "2.6.32") ]
+#
+function linux_version
+{
+ typeset ver="$1"
+
+ [[ -z "$ver" ]] && ver=$(uname -r | grep -Eo "^[0-9]+\.[0-9]+\.[0-9]+")
+
+ typeset version=$(echo $ver | cut -d '.' -f 1)
+ typeset major=$(echo $ver | cut -d '.' -f 2)
+ typeset minor=$(echo $ver | cut -d '.' -f 3)
+
+ [[ -z "$version" ]] && version=0
+ [[ -z "$major" ]] && major=0
+ [[ -z "$minor" ]] && minor=0
+
+ echo $((version * 10000 + major * 100 + minor))
+}
+
# Determine if this is a Linux test system
#
# Return 0 if platform Linux, 1 if otherwise
diff --git a/tests/zfs-tests/include/properties.shlib b/tests/zfs-tests/include/properties.shlib
index 6a3a0e1ce..25a9846dd 100644
--- a/tests/zfs-tests/include/properties.shlib
+++ b/tests/zfs-tests/include/properties.shlib
@@ -91,8 +91,17 @@ function get_rand_large_recsize
#
# Functions to toggle on/off properties
#
-typeset -a binary_props=('atime' 'devices' 'exec' 'nbmand' 'readonly' 'setuid'
- 'xattr' 'zoned')
+typeset -a binary_props=('atime' 'devices' 'exec' 'readonly' 'setuid' 'xattr'
+ 'zoned')
+
+if is_linux; then
+ # Only older kernels support non-blocking mandatory locks
+ if [[ $(linux_version) -lt $(linux_version "4.4") ]]; then
+ binary_props+=('nbmand')
+ fi
+else
+ binary_props+=('nbmand')
+fi
function toggle_prop
{
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_set/mountpoint_003_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_set/mountpoint_003_pos.ksh
index dcba41919..9bbb480ae 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_set/mountpoint_003_pos.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_set/mountpoint_003_pos.ksh
@@ -67,11 +67,15 @@ if is_linux; then
set -A args \
"nodev" "dev" \
"noexec" "exec" \
- "mand" "nomand" \
"ro" "rw" \
"nosuid" "suid" \
"xattr" "noxattr" \
"atime" "noatime"
+
+ # Only older kernels support non-blocking mandatory locks
+ if [[ $(linux_version) -lt $(linux_version "4.4") ]]; then
+ args+=("mand" "nomand")
+ fi
else
set -A args \
"devices" "/devices/" "nodevices" "/nodevices/" \