diff mbox series

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

Message ID 20250402070906.393160-6-shinichiro.kawasaki@wdc.com (mailing list archive)
State New
Headers show
Series nvme: test cases for TLS support | expand

Commit Message

Shinichiro Kawasaki April 2, 2025, 7:09 a.m. UTC
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@wdc.com>
---
 tests/nvme/rc | 13 +++++++++++++
 1 file changed, 13 insertions(+)
diff mbox series

Patch

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
+}