Skip to content

Commit 283923d

Browse files
committed
nvme/rc, md/001: check that nvme-cli supports json output format
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/[email protected]/ Fixes: 444f0df ("nvme: check for controller device in _nvme_connect_subsys()") Reported-by: Christoph Hellwig <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Daniel Wagner <[email protected]> Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
1 parent 3b2355a commit 283923d

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

tests/md/001

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ requires() {
2626
_have_driver dm-mod
2727
_have_driver raid1
2828

29+
_have_nvme_cli_with_json_support
2930
_require_nvme_trtype tcp
3031
_have_brd
3132
}

tests/nvme/rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ _set_nvmet_blkdev_type() {
5555
}
5656

5757
_nvme_requires() {
58-
_have_program nvme
5958
_require_nvme_test_img_size 4m
6059
case ${nvme_trtype} in
6160
loop)
@@ -123,6 +122,7 @@ group_setup() {
123122
group_requires() {
124123
_have_root
125124
_NVMET_TRTYPES_is_valid
125+
_have_nvme_cli_with_json_support
126126
}
127127

128128
group_device_requires() {

0 commit comments

Comments
 (0)