@@ -108,6 +108,11 @@ The NVMe tests can be additionally parameterized via environment variables.
tests are repeated to cover all of the transports specified.
This parameter had an old name 'nvme_trtype'. The old name is still usable,
but not recommended.
+- NVMET_BLKDEV_TYPES: 'device', 'file'
+ Set up NVME target backends with the specified block device type. Multiple
+ block device types can be listed with separating spaces. In this case, the
+ tests are repeated to cover all of the block device types specified. Default
+ value is "device file".
- nvme_img_size: '1G' (default)
Run the tests with given image size in bytes. 'm', 'M', 'g'
and 'G' postfix are supported.
@@ -22,6 +22,7 @@ _check_conflict_and_set_default NVMET_TRTYPES nvme_trtype "loop"
nvme_img_size=${nvme_img_size:-"1G"}
nvme_num_iter=${nvme_num_iter:-"1000"}
nvmet_blkdev_type=${nvmet_blkdev_type:-"device"}
+NVMET_BLKDEV_TYPES=${NVMET_BLKDEV_TYPES:-"device file"}
_NVMET_TRTYPES_is_valid() {
local type
@@ -54,6 +55,27 @@ _set_nvme_trtype() {
COND_DESC="nvmet tr=${nvme_trtype}"
}
+_set_nvme_trtype_and_nvmet_blkdev_type() {
+ local index=$1
+ local bd_index tr_index
+ local -a blkdev_types
+ local -a trtypes
+
+ read -r -a blkdev_types <<< "$NVMET_BLKDEV_TYPES"
+ read -r -a trtypes <<< "$NVMET_TRTYPES"
+
+ if [[ -z $index ]]; then
+ echo $(( ${#trtypes[@]} * ${#blkdev_types[@]} ))
+ return
+ fi
+
+ bd_index=$((index / ${#trtypes[@]}))
+ tr_index=$((index % ${#trtypes[@]}))
+ nvmet_blkdev_type=${blkdev_types[bd_index]}
+ nvme_trtype=${trtypes[tr_index]}
+ COND_DESC="nvmet bd=${nvmet_blkdev_type} tr=${nvme_trtype}"
+}
+
# TMPDIR can not be referred out of test() or test_device() context. Instead of
# global variable def_flie_path, use this getter function.
_nvme_def_file_path() {