]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
common,fio: helper for version check
authorKanchan Joshi <joshi.k@samsung.com>
Thu, 13 Apr 2023 08:50:23 +0000 (14:20 +0530)
committerShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Mon, 17 Apr 2023 23:42:22 +0000 (08:42 +0900)
Add new helper _have_fio_ver which checks whether installed fio version
is greater than or equal to input.

Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
common/fio

index bed76d555b2a7a2af8dd91088b3725b9e488a4a8..1db6128be63279af9910e1bf9bb626351dd5a299 100644 (file)
@@ -26,6 +26,21 @@ _have_fio_zbd_zonemode() {
        return 0
 }
 
+# Check whether the version of the fio is greater than or equal to $1.$2.$3
+_have_fio_ver() {
+       local d=$1 e=$2 f=$3
+
+       _have_fio || return $?
+
+       IFS='.' read -r a b c < <(fio --version | cut -c 5- | sed 's/-.*//')
+       if [ $((a * 65536 + b * 256 + c)) -lt $((d * 65536 + e * 256 + f)) ];
+       then
+               SKIP_REASONS+=("fio version too old")
+               return 1
+       fi
+       return 0
+}
+
 declare -A FIO_TERSE_FIELDS
 FIO_TERSE_FIELDS=(
        # Read status