Honor the KVER environment variable for overriding kernel version
detection.

Reported-by: Linda Knippers <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
---
 test/dax-errors.sh |   18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/test/dax-errors.sh b/test/dax-errors.sh
index a383b14fcd5e..25615df44180 100755
--- a/test/dax-errors.sh
+++ b/test/dax-errors.sh
@@ -23,14 +23,16 @@ err() {
        exit $rc
 }
 
-eval $(uname -r | awk -F. '{print "maj="$1 ";" "min="$2}')
-if [ $maj -lt 4 ]; then
-       echo "kernel $maj.$min lacks dax error handling"
-       exit $rc
-elif [ $maj -eq 4 -a $min -lt 7 ]; then
-       echo "kernel $maj.$min lacks dax error handling"
-       exit $rc
-fi
+check_min_kver()
+{
+       local ver="$1"
+       : "${KVER:=$(uname -r)}"
+
+       [ -n "$ver" ] || return 1
+       [[ "$ver" == "$(echo -e "$ver\n$KVER" | sort -V | head -1)" ]]
+}
+
+check_min_kver "4.7" || { echo "kernel $KVER may lack dax error handling"; 
exit $rc; }
 
 set -e
 mkdir -p $MNT

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

Reply via email to