aboutsummaryrefslogtreecommitdiffstats
path: root/tests/zfs-tests/include/libtest.shlib
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/zfs-tests/include/libtest.shlib
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/zfs-tests/include/libtest.shlib')
-rw-r--r--tests/zfs-tests/include/libtest.shlib23
1 files changed, 23 insertions, 0 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