diff mbox series

[1/5,blktests] nvme: allow target subsys set cntlid min/max

Message ID 20200129232921.11771-2-chaitanya.kulkarni@wdc.com (mailing list archive)
State New, archived
Headers show
Series nvme: add cntlid and model testcases | expand

Commit Message

Chaitanya Kulkarni Jan. 29, 2020, 11:29 p.m. UTC
This patch updates helper function create_nvmet_subsystem() to handle
newly introduced cntlid_min and cntlid_max attributes.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 tests/nvme/rc | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Omar Sandoval Feb. 11, 2020, 9:50 p.m. UTC | #1
On Wed, Jan 29, 2020 at 03:29:17PM -0800, Chaitanya Kulkarni wrote:
> This patch updates helper function create_nvmet_subsystem() to handle
> newly introduced cntlid_min and cntlid_max attributes.
> 
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> ---
>  tests/nvme/rc | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/tests/nvme/rc b/tests/nvme/rc
> index 40f0413..d1fa796 100644
> --- a/tests/nvme/rc
> +++ b/tests/nvme/rc
> @@ -121,11 +121,18 @@ _create_nvmet_subsystem() {
>  	local nvmet_subsystem="$1"
>  	local blkdev="$2"
>  	local uuid=$3
> +	local cntlid_min=$4
> +	local cntlid_max=$5
>  	local cfs_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}"
>  
>  	mkdir -p "${cfs_path}"
>  	echo 1 > "${cfs_path}/attr_allow_any_host"
>  	_create_nvmet_ns "${nvmet_subsystem}" "1" "${blkdev}" "${uuid}"
> +
> +	if [ $# -eq 5 ] && [ -f ${cfs_path}/attr_cntlid_min ]; then
> +		echo ${cntlid_min} > ${cfs_path}/attr_cntlid_min
> +		echo ${cntlid_max} > ${cfs_path}/attr_cntlid_max
> +	fi

This has several shellcheck warnings:

tests/nvme/rc:132:26: note: Double quote to prevent globbing and word splitting. [SC2086]
tests/nvme/rc:133:8: note: Double quote to prevent globbing and word splitting. [SC2086]
tests/nvme/rc:133:24: note: Double quote to prevent globbing and word splitting. [SC2086]
tests/nvme/rc:134:8: note: Double quote to prevent globbing and word splitting. [SC2086]
tests/nvme/rc:134:24: note: Double quote to prevent globbing and word splitting. [SC2086]
diff mbox series

Patch

diff --git a/tests/nvme/rc b/tests/nvme/rc
index 40f0413..d1fa796 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -121,11 +121,18 @@  _create_nvmet_subsystem() {
 	local nvmet_subsystem="$1"
 	local blkdev="$2"
 	local uuid=$3
+	local cntlid_min=$4
+	local cntlid_max=$5
 	local cfs_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}"
 
 	mkdir -p "${cfs_path}"
 	echo 1 > "${cfs_path}/attr_allow_any_host"
 	_create_nvmet_ns "${nvmet_subsystem}" "1" "${blkdev}" "${uuid}"
+
+	if [ $# -eq 5 ] && [ -f ${cfs_path}/attr_cntlid_min ]; then
+		echo ${cntlid_min} > ${cfs_path}/attr_cntlid_min
+		echo ${cntlid_max} > ${cfs_path}/attr_cntlid_max
+	fi
 }
 
 _remove_nvmet_ns() {