[PATCH blktests 05/10] nvme/rc: introduce _have_libnvme_ver()

Shin'ichiro Kawasaki shinichiro.kawasaki at wdc.com
Wed Apr 2 00:09:01 PDT 2025


A following patch is going to add a test case which depends on the
version of libnvme linked to nvme-cli. Introduce the helper function
_have_libnvme_ver() to check the version dependency.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki at wdc.com>
---
 tests/nvme/rc | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tests/nvme/rc b/tests/nvme/rc
index 9584610..e52437f 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -617,3 +617,16 @@ _have_systemd_tlshd_service() {
 		SKIP_REASONS+=("Install ktls-utils for tlshd")
 	fi
 }
+
+_have_libnvme_ver() {
+	local ver
+
+	_have_program nvme || return $?
+	ver="$(nvme --version | grep libnvme | cut --delimiter ' ' --fields 3 | sed 's/-.*//')"
+
+	if _compare_three_version_numbers "$ver" "$1" "$2" "$3"; then
+		SKIP_REASONS+=("libnvme version is older than ${1}.${2}.${3:-0}")
+		return 1
+	fi
+	return 0
+}
-- 
2.49.0




More information about the Linux-nvme mailing list