[PATCH blktests 2/2] nvme/rc, md/001: check that nvme-cli supports json output format
Shin'ichiro Kawasaki
shinichiro.kawasaki at wdc.com
Mon May 19 23:18:19 PDT 2025
When nvme-cli is built on a system without the json-c library, the nvme
command does not support the json output format. Consequently, the
"-o json" option, or in the long form "--output-format=json", of the
nvme command fails. It causes the helper function _nvme_connect_subsys()
to break. This leads to silent failures in many test cases in the nvme
test group as well as the test case md/001.
To inform blktests users this prerequisite, call the helper function
_have_nvme_cli_with_json_support(). As to the nvme test group, do the
check in group_requires() so that the check is done only once for all of
the test cases in the group. If the format is unsupported, the nvme test
group and the test case md/001 are skipped, and the reason to skip is
printed. This change makes the nvme command existence check in
_nvme_requires() redundant, then remove it.
Link: https://lore.kernel.org/linux-nvme/20250519054905.GA6156@lst.de/
Fixes: 444f0df9f0c5 ("nvme: check for controller device in _nvme_connect_subsys()")
Reported-by: Christoph Hellwig <hch at lst.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki at wdc.com>
---
tests/md/001 | 1 +
tests/nvme/rc | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/md/001 b/tests/md/001
index f1d92c8..ca7c56a 100755
--- a/tests/md/001
+++ b/tests/md/001
@@ -26,6 +26,7 @@ requires() {
_have_driver dm-mod
_have_driver raid1
+ _have_nvme_cli_with_json_support
_require_nvme_trtype tcp
_have_brd
}
diff --git a/tests/nvme/rc b/tests/nvme/rc
index d86dc13..9dbd1ce 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -55,7 +55,6 @@ _set_nvmet_blkdev_type() {
}
_nvme_requires() {
- _have_program nvme
_require_nvme_test_img_size 4m
case ${nvme_trtype} in
loop)
@@ -123,6 +122,7 @@ group_setup() {
group_requires() {
_have_root
_NVMET_TRTYPES_is_valid
+ _have_nvme_cli_with_json_support
}
group_device_requires() {
--
2.49.0
More information about the Linux-nvme
mailing list