Linux-NVME Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/5 blktest] nvme: add cntlid and model testcases
@ 2020-01-29 23:29 Chaitanya Kulkarni
  2020-01-29 23:29 ` [PATCH 1/5 blktests] nvme: allow target subsys set cntlid min/max Chaitanya Kulkarni
                   ` (5 more replies)
  0 siblings, 6 replies; 18+ messages in thread
From: Chaitanya Kulkarni @ 2020-01-29 23:29 UTC (permalink / raw)
  To: linux-block, linux-nvme; +Cc: Chaitanya Kulkarni

This is a small patch-series which adds two new testcases for
setting up controller IDs and model from configfs.

Regards,
Chaitanya


Chaitanya Kulkarni (5):
  nvme: allow target subsys set cntlid min/max
  nvme: test target cntlid min cntlid max
  nvme: allow target subsys set model
  nvme: test target model attribute
  nvme: make new testcases backward compatible

 tests/nvme/033     | 61 ++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/033.out |  4 +++
 tests/nvme/034     | 63 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/034.out |  3 +++
 tests/nvme/rc      | 24 ++++++++++++++++++
 5 files changed, 155 insertions(+)
 create mode 100755 tests/nvme/033
 create mode 100644 tests/nvme/033.out
 create mode 100755 tests/nvme/034
 create mode 100644 tests/nvme/034.out

Test Log :-

Without cntlid_min/max and model patches :-

nvme/002 (create many subsystems and test discovery)         [passed]
    runtime  15.246s  ...  15.053s
nvme/003 (test if we're sending keep-alives to a discovery controller) [passed]
    runtime  10.057s  ...  10.063s
./check: no group or test named nvme/0004
nvme/005 (reset local loopback target)                       [not run]
    nvme_core module does not have parameter multipath
nvme/006 (create an NVMeOF target with a block device-backed ns) [passed]
    runtime  0.057s  ...  0.065s
nvme/007 (create an NVMeOF target with a file-backed ns)     [passed]
    runtime  0.036s  ...  0.038s
nvme/008 (create an NVMeOF host with a block device-backed ns) [passed]
    runtime  1.233s  ...  1.240s
nvme/009 (create an NVMeOF host with a file-backed ns)       [passed]
    runtime  1.203s  ...  1.208s
nvme/014 (flush a NVMeOF block device-backed ns)             [passed]
    runtime  14.572s  ...  16.051s
nvme/015 (unit test for NVMe flush for file backed ns)       [passed]
    runtime  13.584s  ...  13.948s
nvme/016 (create/delete many NVMeOF block device-backed ns and test discovery) [passed]
    runtime  9.877s  ...  10.750s
nvme/017 (create/delete many file-ns and test discovery)     [passed]
    runtime  18.902s  ...  15.584s
nvme/019 (test NVMe DSM Discard command on NVMeOF block-device ns) [passed]
    runtime  1.217s  ...  1.237s
nvme/020 (test NVMe DSM Discard command on NVMeOF file-backed ns) [passed]
    runtime  1.204s  ...  1.193s
nvme/021 (test NVMe list command on NVMeOF file-backed ns)   [passed]
    runtime  1.204s  ...  1.195s
nvme/022 (test NVMe reset command on NVMeOF file-backed ns)  [passed]
    runtime    ...  1.334s
nvme/023 (test NVMe smart-log command on NVMeOF block-device ns) [passed]
    runtime  1.218s  ...  1.231s
nvme/024 (test NVMe smart-log command on NVMeOF file-backed ns) [passed]
    runtime  1.207s  ...  1.196s
nvme/025 (test NVMe effects-log command on NVMeOF file-backed ns) [passed]
    runtime  1.191s  ...  1.195s
nvme/026 (test NVMe ns-descs command on NVMeOF file-backed ns) [passed]
    runtime  1.192s  ...  1.196s
nvme/027 (test NVMe ns-rescan command on NVMeOF file-backed ns) [passed]
    runtime  1.211s  ...  1.191s
nvme/028 (test NVMe list-subsys command on NVMeOF file-backed ns) [passed]
    runtime  1.204s  ...  1.211s
nvme/033 (Test NVMeOF target cntlid[min|max] attributes)     [not run]
    attr_cntlid_[min|max] not found
nvme/034 (Test NVMeOF target model attribute)                [not run]
    attr_cntlid_model not found

With cntlid_min/max and model patches :-

nvme/002 (create many subsystems and test discovery)         [passed]
    runtime  15.053s  ...  11.918s
nvme/003 (test if we're sending keep-alives to a discovery controller) [passed]
    runtime  10.063s  ...  10.058s
./check: no group or test named nvme/0004
nvme/005 (reset local loopback target)                       [not run]
    nvme_core module does not have parameter multipath
nvme/006 (create an NVMeOF target with a block device-backed ns) [passed]
    runtime  0.065s  ...  0.065s
nvme/007 (create an NVMeOF target with a file-backed ns)     [passed]
    runtime  0.038s  ...  0.036s
nvme/008 (create an NVMeOF host with a block device-backed ns) [passed]
    runtime  1.240s  ...  1.239s
nvme/009 (create an NVMeOF host with a file-backed ns)       [passed]
    runtime  1.208s  ...  1.207s
nvme/014 (flush a NVMeOF block device-backed ns)             [passed]
    runtime  16.051s  ...  15.345s
nvme/015 (unit test for NVMe flush for file backed ns)       [passed]
    runtime  13.948s  ...  13.977s
nvme/016 (create/delete many NVMeOF block device-backed ns and test discovery) [passed]
    runtime  10.750s  ...  9.698s
nvme/017 (create/delete many file-ns and test discovery)     [passed]
    runtime  15.584s  ...  15.514s
nvme/019 (test NVMe DSM Discard command on NVMeOF block-device ns) [passed]
    runtime  1.237s  ...  1.232s
nvme/020 (test NVMe DSM Discard command on NVMeOF file-backed ns) [passed]
    runtime  1.193s  ...  1.192s
nvme/021 (test NVMe list command on NVMeOF file-backed ns)   [passed]
    runtime  1.195s  ...  1.195s
nvme/022 (test NVMe reset command on NVMeOF file-backed ns)  [passed]
    runtime  1.334s  ...  1.340s
nvme/023 (test NVMe smart-log command on NVMeOF block-device ns) [passed]
    runtime  1.231s  ...  1.218s
nvme/024 (test NVMe smart-log command on NVMeOF file-backed ns) [passed]
    runtime  1.196s  ...  1.205s
nvme/025 (test NVMe effects-log command on NVMeOF file-backed ns) [passed]
    runtime  1.195s  ...  1.191s
nvme/026 (test NVMe ns-descs command on NVMeOF file-backed ns) [passed]
    runtime  1.196s  ...  1.186s
nvme/027 (test NVMe ns-rescan command on NVMeOF file-backed ns) [passed]
    runtime  1.191s  ...  1.192s
nvme/028 (test NVMe list-subsys command on NVMeOF file-backed ns) [passed]
    runtime  1.211s  ...  1.187s
nvme/033 (Test NVMeOF target cntlid[min|max] attributes)     [passed]
    runtime  1.213s  ...  1.200s
nvme/034 (Test NVMeOF target model attribute)                [passed]
    runtime  1.223s  ...  1.204s


-- 
2.22.1


_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/5 blktests] nvme: allow target subsys set cntlid min/max
  2020-01-29 23:29 [PATCH 0/5 blktest] nvme: add cntlid and model testcases Chaitanya Kulkarni
@ 2020-01-29 23:29 ` Chaitanya Kulkarni
  2020-02-11 21:50   ` Omar Sandoval
  2020-01-29 23:29 ` [PATCH 2/5 blktests] nvme: test target cntlid min cntlid max Chaitanya Kulkarni
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 18+ messages in thread
From: Chaitanya Kulkarni @ 2020-01-29 23:29 UTC (permalink / raw)
  To: linux-block, linux-nvme; +Cc: Chaitanya Kulkarni

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
 }
 
 _remove_nvmet_ns() {
-- 
2.22.1


_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 2/5 blktests] nvme: test target cntlid min cntlid max
  2020-01-29 23:29 [PATCH 0/5 blktest] nvme: add cntlid and model testcases Chaitanya Kulkarni
  2020-01-29 23:29 ` [PATCH 1/5 blktests] nvme: allow target subsys set cntlid min/max Chaitanya Kulkarni
@ 2020-01-29 23:29 ` Chaitanya Kulkarni
  2020-02-11 21:58   ` Omar Sandoval
  2020-01-29 23:29 ` [PATCH 3/5 blktests] nvme: allow target subsys set model Chaitanya Kulkarni
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 18+ messages in thread
From: Chaitanya Kulkarni @ 2020-01-29 23:29 UTC (permalink / raw)
  To: linux-block, linux-nvme; +Cc: Chaitanya Kulkarni

The new testcases exercises newly added cntlid [min|max] attributes
for NVMeOF target.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 tests/nvme/033     | 57 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/033.out |  4 ++++
 2 files changed, 61 insertions(+)
 create mode 100755 tests/nvme/033
 create mode 100644 tests/nvme/033.out

diff --git a/tests/nvme/033 b/tests/nvme/033
new file mode 100755
index 0000000..97eba7f
--- /dev/null
+++ b/tests/nvme/033
@@ -0,0 +1,57 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates.
+#
+# Test NVMeOF target cntlid[min|max] attributes.
+
+. tests/nvme/rc
+
+DESCRIPTION="Test NVMeOF target cntlid[min|max] attributes"
+QUICK=1
+
+requires() {
+	_have_program nvme && _have_modules loop nvme-loop nvmet && \
+		_have_configfs
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	_setup_nvmet
+
+	local port
+	local nvmedev
+	local loop_dev
+	local cid_min=14
+	local cid_max=15
+	local file_path="$TMPDIR/img"
+	local subsys_name="blktests-subsystem-1"
+
+	truncate -s 1G "${file_path}"
+
+	loop_dev="$(losetup -f --show "${file_path}")"
+
+	_create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \
+		"91fdba0d-f87b-4c25-b80f-db7be1418b9e" ${cid_min} ${cid_max}
+	port="$(_create_nvmet_port "loop")"
+	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+
+	nvme connect -t loop -n "${subsys_name}"
+
+	udevadm settle
+
+	nvmedev="$(_find_nvme_loop_dev)"
+	nvme id-ctrl /dev/${nvmedev}n1 | grep cntlid | tr -s ' ' ' '
+
+	nvme disconnect -n "${subsys_name}"
+
+	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
+	_remove_nvmet_subsystem "${subsys_name}"
+	_remove_nvmet_port "${port}"
+
+	losetup -d "${loop_dev}"
+
+	rm "${file_path}"
+
+	echo "Test complete"
+}
diff --git a/tests/nvme/033.out b/tests/nvme/033.out
new file mode 100644
index 0000000..b1b0d15
--- /dev/null
+++ b/tests/nvme/033.out
@@ -0,0 +1,4 @@
+Running nvme/033
+cntlid : e
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Test complete
-- 
2.22.1


_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 3/5 blktests] nvme: allow target subsys set model
  2020-01-29 23:29 [PATCH 0/5 blktest] nvme: add cntlid and model testcases Chaitanya Kulkarni
  2020-01-29 23:29 ` [PATCH 1/5 blktests] nvme: allow target subsys set cntlid min/max Chaitanya Kulkarni
  2020-01-29 23:29 ` [PATCH 2/5 blktests] nvme: test target cntlid min cntlid max Chaitanya Kulkarni
@ 2020-01-29 23:29 ` Chaitanya Kulkarni
  2020-02-11 22:00   ` Omar Sandoval
  2020-01-29 23:29 ` [PATCH 4/5 blktests] nvme: test target model attribute Chaitanya Kulkarni
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 18+ messages in thread
From: Chaitanya Kulkarni @ 2020-01-29 23:29 UTC (permalink / raw)
  To: linux-block, linux-nvme; +Cc: Chaitanya Kulkarni

This patch updates helper function create_nvmet_subsystem() to handle
newly introduced model attribute.

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

diff --git a/tests/nvme/rc b/tests/nvme/rc
index d1fa796..377c7f7 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -123,6 +123,7 @@ _create_nvmet_subsystem() {
 	local uuid=$3
 	local cntlid_min=$4
 	local cntlid_max=$5
+	local model=$6
 	local cfs_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}"
 
 	mkdir -p "${cfs_path}"
@@ -133,6 +134,9 @@ _create_nvmet_subsystem() {
 		echo ${cntlid_min} > ${cfs_path}/attr_cntlid_min
 		echo ${cntlid_max} > ${cfs_path}/attr_cntlid_max
 	fi
+	if [ $# -eq 6 ] && [ -f ${cfs_path}/attr_model ]; then
+		echo ${model} > ${cfs_path}/attr_model
+	fi
 }
 
 _remove_nvmet_ns() {
-- 
2.22.1


_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 4/5 blktests] nvme: test target model attribute
  2020-01-29 23:29 [PATCH 0/5 blktest] nvme: add cntlid and model testcases Chaitanya Kulkarni
                   ` (2 preceding siblings ...)
  2020-01-29 23:29 ` [PATCH 3/5 blktests] nvme: allow target subsys set model Chaitanya Kulkarni
@ 2020-01-29 23:29 ` Chaitanya Kulkarni
  2020-02-11 22:04   ` Omar Sandoval
  2020-01-29 23:29 ` [PATCH 5/5 blktests] nvme: make new testcases backward compatible Chaitanya Kulkarni
  2020-02-03 22:48 ` [PATCH 0/5 blktest] nvme: add cntlid and model testcases Chaitanya Kulkarni
  5 siblings, 1 reply; 18+ messages in thread
From: Chaitanya Kulkarni @ 2020-01-29 23:29 UTC (permalink / raw)
  To: linux-block, linux-nvme; +Cc: Chaitanya Kulkarni

The new testcases exercises newly added cntlid [min|max] attribute for
NVMeOF target.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 tests/nvme/034     | 60 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/034.out |  3 +++
 2 files changed, 63 insertions(+)
 create mode 100755 tests/nvme/034
 create mode 100644 tests/nvme/034.out

diff --git a/tests/nvme/034 b/tests/nvme/034
new file mode 100755
index 0000000..1a55ff9
--- /dev/null
+++ b/tests/nvme/034
@@ -0,0 +1,60 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates.
+#
+# Test NVMeOF target cntlid[min|max] attributes.
+
+. tests/nvme/rc
+
+DESCRIPTION="Test NVMeOF target model attribute"
+QUICK=1
+
+requires() {
+	_have_program nvme && _have_modules loop nvme-loop nvmet && \
+		_have_configfs
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	_setup_nvmet
+
+	local port
+	local result
+	local nvmedev
+	local loop_dev
+	local model="test~model"
+	local file_path="$TMPDIR/img"
+	local subsys_name="blktests-subsystem-1"
+
+	truncate -s 1G "${file_path}"
+
+	loop_dev="$(losetup -f --show "${file_path}")"
+
+	_create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \
+		"91fdba0d-f87b-4c25-b80f-db7be1418b9e" 0 100 ${model}
+	port="$(_create_nvmet_port "loop")"
+	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+
+	nvme connect -t loop -n "${subsys_name}"
+
+	udevadm settle
+
+	nvmedev="$(_find_nvme_loop_dev)"
+	nvme list | grep ${nvmedev}n1 | grep -q test~model
+	result=$?
+
+	nvme disconnect -n "${subsys_name}"
+
+	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
+	_remove_nvmet_subsystem "${subsys_name}"
+	_remove_nvmet_port "${port}"
+
+	losetup -d "${loop_dev}"
+
+	rm "${file_path}"
+
+	if [ ${result} -eq 0 ]; then
+		echo "Test complete"
+	fi
+}
diff --git a/tests/nvme/034.out b/tests/nvme/034.out
new file mode 100644
index 0000000..0a7bd2f
--- /dev/null
+++ b/tests/nvme/034.out
@@ -0,0 +1,3 @@
+Running nvme/034
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Test complete
-- 
2.22.1


_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 5/5 blktests] nvme: make new testcases backward compatible
  2020-01-29 23:29 [PATCH 0/5 blktest] nvme: add cntlid and model testcases Chaitanya Kulkarni
                   ` (3 preceding siblings ...)
  2020-01-29 23:29 ` [PATCH 4/5 blktests] nvme: test target model attribute Chaitanya Kulkarni
@ 2020-01-29 23:29 ` Chaitanya Kulkarni
  2020-02-11 22:06   ` Omar Sandoval
  2020-02-03 22:48 ` [PATCH 0/5 blktest] nvme: add cntlid and model testcases Chaitanya Kulkarni
  5 siblings, 1 reply; 18+ messages in thread
From: Chaitanya Kulkarni @ 2020-01-29 23:29 UTC (permalink / raw)
  To: linux-block, linux-nvme; +Cc: Chaitanya Kulkarni

This patch makes newly added testcases backward compatible with
right value setting into the SKIP_REASON variable.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 tests/nvme/033 | 60 +++++++++++++++++++++++++++-----------------------
 tests/nvme/034 | 59 ++++++++++++++++++++++++++-----------------------
 tests/nvme/rc  | 27 +++++++++++++++++------
 3 files changed, 83 insertions(+), 63 deletions(-)

diff --git a/tests/nvme/033 b/tests/nvme/033
index 97eba7f..db5ded3 100755
--- a/tests/nvme/033
+++ b/tests/nvme/033
@@ -9,49 +9,53 @@
 DESCRIPTION="Test NVMeOF target cntlid[min|max] attributes"
 QUICK=1
 
+PORT=""
+NVMEDEV=""
+LOOP_DEV=""
+FILE_PATH="$TMPDIR/img"
+SUBSYS_NAME="blktests-subsystem-1"
+
+_have_cid_min_max()
+{
+	local cid_min=14
+	local cid_max=15
+
+	_setup_nvmet
+	truncate -s 1G "${FILE_PATH}"
+	LOOP_DEV="$(losetup -f --show "${FILE_PATH}")"
+
+	# we can only know skip reason when we create a subsys
+	 _create_nvmet_subsystem "${SUBSYS_NAME}" "${LOOP_DEV}" \
+		"91fdba0d-f87b-4c25-b80f-db7be1418b9e" ${cid_min} ${cid_max}
+}
+
 requires() {
 	_have_program nvme && _have_modules loop nvme-loop nvmet && \
-		_have_configfs
+		_have_configfs && _have_cid_min_max
 }
 
 test() {
 	echo "Running ${TEST_NAME}"
 
-	_setup_nvmet
-
-	local port
-	local nvmedev
-	local loop_dev
-	local cid_min=14
-	local cid_max=15
-	local file_path="$TMPDIR/img"
-	local subsys_name="blktests-subsystem-1"
-
-	truncate -s 1G "${file_path}"
-
-	loop_dev="$(losetup -f --show "${file_path}")"
-
-	_create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \
-		"91fdba0d-f87b-4c25-b80f-db7be1418b9e" ${cid_min} ${cid_max}
-	port="$(_create_nvmet_port "loop")"
-	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+	PORT="$(_create_nvmet_port "loop")"
+	_add_nvmet_subsys_to_port "${PORT}" "${SUBSYS_NAME}"
 
-	nvme connect -t loop -n "${subsys_name}"
+	nvme connect -t loop -n "${SUBSYS_NAME}"
 
 	udevadm settle
 
-	nvmedev="$(_find_nvme_loop_dev)"
-	nvme id-ctrl /dev/${nvmedev}n1 | grep cntlid | tr -s ' ' ' '
+	NVMEDEV="$(_find_nvme_loop_dev)"
+	nvme id-ctrl /dev/${NVMEDEV}n1 | grep cntlid | tr -s ' ' ' '
 
-	nvme disconnect -n "${subsys_name}"
+	nvme disconnect -n "${SUBSYS_NAME}"
 
-	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
-	_remove_nvmet_subsystem "${subsys_name}"
-	_remove_nvmet_port "${port}"
+	_remove_nvmet_subsystem_from_port "${PORT}" "${SUBSYS_NAME}"
+	_remove_nvmet_subsystem "${SUBSYS_NAME}"
+	_remove_nvmet_port "${PORT}"
 
-	losetup -d "${loop_dev}"
+	losetup -d "${LOOP_DEV}"
 
-	rm "${file_path}"
+	rm "${FILE_PATH}"
 
 	echo "Test complete"
 }
diff --git a/tests/nvme/034 b/tests/nvme/034
index 1a55ff9..39d833f 100755
--- a/tests/nvme/034
+++ b/tests/nvme/034
@@ -9,50 +9,53 @@
 DESCRIPTION="Test NVMeOF target model attribute"
 QUICK=1
 
+PORT=""
+NVMEDEV=""
+LOOP_DEV=""
+FILE_PATH="$TMPDIR/img"
+SUBSYS_NAME="blktests-subsystem-1"
+
+_have_model()
+{
+	local model="test~model"
+
+	_setup_nvmet
+	truncate -s 1G "${FILE_PATH}"
+	LOOP_DEV="$(losetup -f --show "${FILE_PATH}")"
+
+	# we can only know skip reason when we create a subsys
+	 _create_nvmet_subsystem "${SUBSYS_NAME}" "${LOOP_DEV}" \
+		"91fdba0d-f87b-4c25-b80f-db7be1418b9e" 14 15 \
+		${model}
+}
 requires() {
 	_have_program nvme && _have_modules loop nvme-loop nvmet && \
-		_have_configfs
+		_have_configfs && _have_model
 }
 
 test() {
 	echo "Running ${TEST_NAME}"
 
-	_setup_nvmet
-
-	local port
-	local result
-	local nvmedev
-	local loop_dev
-	local model="test~model"
-	local file_path="$TMPDIR/img"
-	local subsys_name="blktests-subsystem-1"
-
-	truncate -s 1G "${file_path}"
-
-	loop_dev="$(losetup -f --show "${file_path}")"
-
-	_create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \
-		"91fdba0d-f87b-4c25-b80f-db7be1418b9e" 0 100 ${model}
-	port="$(_create_nvmet_port "loop")"
-	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+	PORT="$(_create_nvmet_port "loop")"
+	_add_nvmet_subsys_to_port "${PORT}" "${SUBSYS_NAME}"
 
-	nvme connect -t loop -n "${subsys_name}"
+	nvme connect -t loop -n "${SUBSYS_NAME}"
 
 	udevadm settle
 
-	nvmedev="$(_find_nvme_loop_dev)"
-	nvme list | grep ${nvmedev}n1 | grep -q test~model
+	NVMEDEV="$(_find_nvme_loop_dev)"
+	nvme list | grep ${NVMEDEV}n1 | grep -q test~model
 	result=$?
 
-	nvme disconnect -n "${subsys_name}"
+	nvme disconnect -n "${SUBSYS_NAME}"
 
-	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
-	_remove_nvmet_subsystem "${subsys_name}"
-	_remove_nvmet_port "${port}"
+	_remove_nvmet_subsystem_from_port "${PORT}" "${SUBSYS_NAME}"
+	_remove_nvmet_subsystem "${SUBSYS_NAME}"
+	_remove_nvmet_port "${PORT}"
 
-	losetup -d "${loop_dev}"
+	losetup -d "${LOOP_DEV}"
 
-	rm "${file_path}"
+	rm "${FILE_PATH}"
 
 	if [ ${result} -eq 0 ]; then
 		echo "Test complete"
diff --git a/tests/nvme/rc b/tests/nvme/rc
index 377c7f7..77bafd8 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -128,15 +128,28 @@ _create_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
+	if [ $# -eq 5 ]; then
+		if [ -f ${cfs_path}/attr_cntlid_min ]; then
+			echo ${cntlid_min} > ${cfs_path}/attr_cntlid_min
+			echo ${cntlid_max} > ${cfs_path}/attr_cntlid_max
+		else
+			SKIP_REASON="attr_cntlid_[min|max] not found"
+			rmdir "${cfs_path}"
+			return 1
+		fi
 	fi
-	if [ $# -eq 6 ] && [ -f ${cfs_path}/attr_model ]; then
-		echo ${model} > ${cfs_path}/attr_model
+	if [ $# -eq 6 ]; then
+		if [ -f ${cfs_path}/attr_model ]; then
+			echo ${model} > ${cfs_path}/attr_model
+		else
+			SKIP_REASON="attr_cntlid_model not found"
+			rmdir "${cfs_path}"
+			return 1
+		fi
 	fi
+	_create_nvmet_ns "${nvmet_subsystem}" "1" "${blkdev}" "${uuid}"
+
+	return 0
 }
 
 _remove_nvmet_ns() {
-- 
2.22.1


_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/5 blktest] nvme: add cntlid and model testcases
  2020-01-29 23:29 [PATCH 0/5 blktest] nvme: add cntlid and model testcases Chaitanya Kulkarni
                   ` (4 preceding siblings ...)
  2020-01-29 23:29 ` [PATCH 5/5 blktests] nvme: make new testcases backward compatible Chaitanya Kulkarni
@ 2020-02-03 22:48 ` Chaitanya Kulkarni
  2020-02-11 16:46   ` Chaitanya Kulkarni
  5 siblings, 1 reply; 18+ messages in thread
From: Chaitanya Kulkarni @ 2020-02-03 22:48 UTC (permalink / raw)
  To: linux-block, linux-nvme; +Cc: Omar Sandoval

(+ Omar)

On 01/29/2020 03:29 PM, Chaitanya Kulkarni wrote:
> This is a small patch-series which adds two new testcases for
> setting up controller IDs and model from configfs.
>
> Regards,
> Chaitanya
>
>
> Chaitanya Kulkarni (5):
>    nvme: allow target subsys set cntlid min/max
>    nvme: test target cntlid min cntlid max
>    nvme: allow target subsys set model
>    nvme: test target model attribute
>    nvme: make new testcases backward compatible
>
>   tests/nvme/033     | 61 ++++++++++++++++++++++++++++++++++++++++++++
>   tests/nvme/033.out |  4 +++
>   tests/nvme/034     | 63 ++++++++++++++++++++++++++++++++++++++++++++++
>   tests/nvme/034.out |  3 +++
>   tests/nvme/rc      | 24 ++++++++++++++++++
>   5 files changed, 155 insertions(+)
>   create mode 100755 tests/nvme/033
>   create mode 100644 tests/nvme/033.out
>   create mode 100755 tests/nvme/034
>   create mode 100644 tests/nvme/034.out
>
> Test Log :-
>
> Without cntlid_min/max and model patches :-
>
> nvme/002 (create many subsystems and test discovery)         [passed]
>      runtime  15.246s  ...  15.053s
> nvme/003 (test if we're sending keep-alives to a discovery controller) [passed]
>      runtime  10.057s  ...  10.063s
> ./check: no group or test named nvme/0004
> nvme/005 (reset local loopback target)                       [not run]
>      nvme_core module does not have parameter multipath
> nvme/006 (create an NVMeOF target with a block device-backed ns) [passed]
>      runtime  0.057s  ...  0.065s
> nvme/007 (create an NVMeOF target with a file-backed ns)     [passed]
>      runtime  0.036s  ...  0.038s
> nvme/008 (create an NVMeOF host with a block device-backed ns) [passed]
>      runtime  1.233s  ...  1.240s
> nvme/009 (create an NVMeOF host with a file-backed ns)       [passed]
>      runtime  1.203s  ...  1.208s
> nvme/014 (flush a NVMeOF block device-backed ns)             [passed]
>      runtime  14.572s  ...  16.051s
> nvme/015 (unit test for NVMe flush for file backed ns)       [passed]
>      runtime  13.584s  ...  13.948s
> nvme/016 (create/delete many NVMeOF block device-backed ns and test discovery) [passed]
>      runtime  9.877s  ...  10.750s
> nvme/017 (create/delete many file-ns and test discovery)     [passed]
>      runtime  18.902s  ...  15.584s
> nvme/019 (test NVMe DSM Discard command on NVMeOF block-device ns) [passed]
>      runtime  1.217s  ...  1.237s
> nvme/020 (test NVMe DSM Discard command on NVMeOF file-backed ns) [passed]
>      runtime  1.204s  ...  1.193s
> nvme/021 (test NVMe list command on NVMeOF file-backed ns)   [passed]
>      runtime  1.204s  ...  1.195s
> nvme/022 (test NVMe reset command on NVMeOF file-backed ns)  [passed]
>      runtime    ...  1.334s
> nvme/023 (test NVMe smart-log command on NVMeOF block-device ns) [passed]
>      runtime  1.218s  ...  1.231s
> nvme/024 (test NVMe smart-log command on NVMeOF file-backed ns) [passed]
>      runtime  1.207s  ...  1.196s
> nvme/025 (test NVMe effects-log command on NVMeOF file-backed ns) [passed]
>      runtime  1.191s  ...  1.195s
> nvme/026 (test NVMe ns-descs command on NVMeOF file-backed ns) [passed]
>      runtime  1.192s  ...  1.196s
> nvme/027 (test NVMe ns-rescan command on NVMeOF file-backed ns) [passed]
>      runtime  1.211s  ...  1.191s
> nvme/028 (test NVMe list-subsys command on NVMeOF file-backed ns) [passed]
>      runtime  1.204s  ...  1.211s
> nvme/033 (Test NVMeOF target cntlid[min|max] attributes)     [not run]
>      attr_cntlid_[min|max] not found
> nvme/034 (Test NVMeOF target model attribute)                [not run]
>      attr_cntlid_model not found
>
> With cntlid_min/max and model patches :-
>
> nvme/002 (create many subsystems and test discovery)         [passed]
>      runtime  15.053s  ...  11.918s
> nvme/003 (test if we're sending keep-alives to a discovery controller) [passed]
>      runtime  10.063s  ...  10.058s
> ./check: no group or test named nvme/0004
> nvme/005 (reset local loopback target)                       [not run]
>      nvme_core module does not have parameter multipath
> nvme/006 (create an NVMeOF target with a block device-backed ns) [passed]
>      runtime  0.065s  ...  0.065s
> nvme/007 (create an NVMeOF target with a file-backed ns)     [passed]
>      runtime  0.038s  ...  0.036s
> nvme/008 (create an NVMeOF host with a block device-backed ns) [passed]
>      runtime  1.240s  ...  1.239s
> nvme/009 (create an NVMeOF host with a file-backed ns)       [passed]
>      runtime  1.208s  ...  1.207s
> nvme/014 (flush a NVMeOF block device-backed ns)             [passed]
>      runtime  16.051s  ...  15.345s
> nvme/015 (unit test for NVMe flush for file backed ns)       [passed]
>      runtime  13.948s  ...  13.977s
> nvme/016 (create/delete many NVMeOF block device-backed ns and test discovery) [passed]
>      runtime  10.750s  ...  9.698s
> nvme/017 (create/delete many file-ns and test discovery)     [passed]
>      runtime  15.584s  ...  15.514s
> nvme/019 (test NVMe DSM Discard command on NVMeOF block-device ns) [passed]
>      runtime  1.237s  ...  1.232s
> nvme/020 (test NVMe DSM Discard command on NVMeOF file-backed ns) [passed]
>      runtime  1.193s  ...  1.192s
> nvme/021 (test NVMe list command on NVMeOF file-backed ns)   [passed]
>      runtime  1.195s  ...  1.195s
> nvme/022 (test NVMe reset command on NVMeOF file-backed ns)  [passed]
>      runtime  1.334s  ...  1.340s
> nvme/023 (test NVMe smart-log command on NVMeOF block-device ns) [passed]
>      runtime  1.231s  ...  1.218s
> nvme/024 (test NVMe smart-log command on NVMeOF file-backed ns) [passed]
>      runtime  1.196s  ...  1.205s
> nvme/025 (test NVMe effects-log command on NVMeOF file-backed ns) [passed]
>      runtime  1.195s  ...  1.191s
> nvme/026 (test NVMe ns-descs command on NVMeOF file-backed ns) [passed]
>      runtime  1.196s  ...  1.186s
> nvme/027 (test NVMe ns-rescan command on NVMeOF file-backed ns) [passed]
>      runtime  1.191s  ...  1.192s
> nvme/028 (test NVMe list-subsys command on NVMeOF file-backed ns) [passed]
>      runtime  1.211s  ...  1.187s
> nvme/033 (Test NVMeOF target cntlid[min|max] attributes)     [passed]
>      runtime  1.213s  ...  1.200s
> nvme/034 (Test NVMeOF target model attribute)                [passed]
>      runtime  1.223s  ...  1.204s
>
>


_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/5 blktest] nvme: add cntlid and model testcases
  2020-02-03 22:48 ` [PATCH 0/5 blktest] nvme: add cntlid and model testcases Chaitanya Kulkarni
@ 2020-02-11 16:46   ` Chaitanya Kulkarni
  2020-02-11 22:07     ` Omar Sandoval
  0 siblings, 1 reply; 18+ messages in thread
From: Chaitanya Kulkarni @ 2020-02-11 16:46 UTC (permalink / raw)
  To: linux-block, linux-nvme; +Cc: Omar Sandoval

Ping ?

On 02/03/2020 02:48 PM, Chaitanya Kulkarni wrote:
> (+ Omar)
>
> On 01/29/2020 03:29 PM, Chaitanya Kulkarni wrote:
>> This is a small patch-series which adds two new testcases for
>> setting up controller IDs and model from configfs.
>>
>> Regards,
>> Chaitanya
>>
>>
>> Chaitanya Kulkarni (5):
>>     nvme: allow target subsys set cntlid min/max
>>     nvme: test target cntlid min cntlid max
>>     nvme: allow target subsys set model
>>     nvme: test target model attribute
>>     nvme: make new testcases backward compatible
>>
>>    tests/nvme/033     | 61 ++++++++++++++++++++++++++++++++++++++++++++
>>    tests/nvme/033.out |  4 +++
>>    tests/nvme/034     | 63 ++++++++++++++++++++++++++++++++++++++++++++++
>>    tests/nvme/034.out |  3 +++
>>    tests/nvme/rc      | 24 ++++++++++++++++++
>>    5 files changed, 155 insertions(+)
>>    create mode 100755 tests/nvme/033
>>    create mode 100644 tests/nvme/033.out
>>    create mode 100755 tests/nvme/034
>>    create mode 100644 tests/nvme/034.out
>>
>> Test Log :-
>>
>> Without cntlid_min/max and model patches :-
>>
>> nvme/002 (create many subsystems and test discovery)         [passed]
>>       runtime  15.246s  ...  15.053s
>> nvme/003 (test if we're sending keep-alives to a discovery controller) [passed]
>>       runtime  10.057s  ...  10.063s
>> ./check: no group or test named nvme/0004
>> nvme/005 (reset local loopback target)                       [not run]
>>       nvme_core module does not have parameter multipath
>> nvme/006 (create an NVMeOF target with a block device-backed ns) [passed]
>>       runtime  0.057s  ...  0.065s
>> nvme/007 (create an NVMeOF target with a file-backed ns)     [passed]
>>       runtime  0.036s  ...  0.038s
>> nvme/008 (create an NVMeOF host with a block device-backed ns) [passed]
>>       runtime  1.233s  ...  1.240s
>> nvme/009 (create an NVMeOF host with a file-backed ns)       [passed]
>>       runtime  1.203s  ...  1.208s
>> nvme/014 (flush a NVMeOF block device-backed ns)             [passed]
>>       runtime  14.572s  ...  16.051s
>> nvme/015 (unit test for NVMe flush for file backed ns)       [passed]
>>       runtime  13.584s  ...  13.948s
>> nvme/016 (create/delete many NVMeOF block device-backed ns and test discovery) [passed]
>>       runtime  9.877s  ...  10.750s
>> nvme/017 (create/delete many file-ns and test discovery)     [passed]
>>       runtime  18.902s  ...  15.584s
>> nvme/019 (test NVMe DSM Discard command on NVMeOF block-device ns) [passed]
>>       runtime  1.217s  ...  1.237s
>> nvme/020 (test NVMe DSM Discard command on NVMeOF file-backed ns) [passed]
>>       runtime  1.204s  ...  1.193s
>> nvme/021 (test NVMe list command on NVMeOF file-backed ns)   [passed]
>>       runtime  1.204s  ...  1.195s
>> nvme/022 (test NVMe reset command on NVMeOF file-backed ns)  [passed]
>>       runtime    ...  1.334s
>> nvme/023 (test NVMe smart-log command on NVMeOF block-device ns) [passed]
>>       runtime  1.218s  ...  1.231s
>> nvme/024 (test NVMe smart-log command on NVMeOF file-backed ns) [passed]
>>       runtime  1.207s  ...  1.196s
>> nvme/025 (test NVMe effects-log command on NVMeOF file-backed ns) [passed]
>>       runtime  1.191s  ...  1.195s
>> nvme/026 (test NVMe ns-descs command on NVMeOF file-backed ns) [passed]
>>       runtime  1.192s  ...  1.196s
>> nvme/027 (test NVMe ns-rescan command on NVMeOF file-backed ns) [passed]
>>       runtime  1.211s  ...  1.191s
>> nvme/028 (test NVMe list-subsys command on NVMeOF file-backed ns) [passed]
>>       runtime  1.204s  ...  1.211s
>> nvme/033 (Test NVMeOF target cntlid[min|max] attributes)     [not run]
>>       attr_cntlid_[min|max] not found
>> nvme/034 (Test NVMeOF target model attribute)                [not run]
>>       attr_cntlid_model not found
>>
>> With cntlid_min/max and model patches :-
>>
>> nvme/002 (create many subsystems and test discovery)         [passed]
>>       runtime  15.053s  ...  11.918s
>> nvme/003 (test if we're sending keep-alives to a discovery controller) [passed]
>>       runtime  10.063s  ...  10.058s
>> ./check: no group or test named nvme/0004
>> nvme/005 (reset local loopback target)                       [not run]
>>       nvme_core module does not have parameter multipath
>> nvme/006 (create an NVMeOF target with a block device-backed ns) [passed]
>>       runtime  0.065s  ...  0.065s
>> nvme/007 (create an NVMeOF target with a file-backed ns)     [passed]
>>       runtime  0.038s  ...  0.036s
>> nvme/008 (create an NVMeOF host with a block device-backed ns) [passed]
>>       runtime  1.240s  ...  1.239s
>> nvme/009 (create an NVMeOF host with a file-backed ns)       [passed]
>>       runtime  1.208s  ...  1.207s
>> nvme/014 (flush a NVMeOF block device-backed ns)             [passed]
>>       runtime  16.051s  ...  15.345s
>> nvme/015 (unit test for NVMe flush for file backed ns)       [passed]
>>       runtime  13.948s  ...  13.977s
>> nvme/016 (create/delete many NVMeOF block device-backed ns and test discovery) [passed]
>>       runtime  10.750s  ...  9.698s
>> nvme/017 (create/delete many file-ns and test discovery)     [passed]
>>       runtime  15.584s  ...  15.514s
>> nvme/019 (test NVMe DSM Discard command on NVMeOF block-device ns) [passed]
>>       runtime  1.237s  ...  1.232s
>> nvme/020 (test NVMe DSM Discard command on NVMeOF file-backed ns) [passed]
>>       runtime  1.193s  ...  1.192s
>> nvme/021 (test NVMe list command on NVMeOF file-backed ns)   [passed]
>>       runtime  1.195s  ...  1.195s
>> nvme/022 (test NVMe reset command on NVMeOF file-backed ns)  [passed]
>>       runtime  1.334s  ...  1.340s
>> nvme/023 (test NVMe smart-log command on NVMeOF block-device ns) [passed]
>>       runtime  1.231s  ...  1.218s
>> nvme/024 (test NVMe smart-log command on NVMeOF file-backed ns) [passed]
>>       runtime  1.196s  ...  1.205s
>> nvme/025 (test NVMe effects-log command on NVMeOF file-backed ns) [passed]
>>       runtime  1.195s  ...  1.191s
>> nvme/026 (test NVMe ns-descs command on NVMeOF file-backed ns) [passed]
>>       runtime  1.196s  ...  1.186s
>> nvme/027 (test NVMe ns-rescan command on NVMeOF file-backed ns) [passed]
>>       runtime  1.191s  ...  1.192s
>> nvme/028 (test NVMe list-subsys command on NVMeOF file-backed ns) [passed]
>>       runtime  1.211s  ...  1.187s
>> nvme/033 (Test NVMeOF target cntlid[min|max] attributes)     [passed]
>>       runtime  1.213s  ...  1.200s
>> nvme/034 (Test NVMeOF target model attribute)                [passed]
>>       runtime  1.223s  ...  1.204s
>>
>>
>
>


_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/5 blktests] nvme: allow target subsys set cntlid min/max
  2020-01-29 23:29 ` [PATCH 1/5 blktests] nvme: allow target subsys set cntlid min/max Chaitanya Kulkarni
@ 2020-02-11 21:50   ` Omar Sandoval
  0 siblings, 0 replies; 18+ messages in thread
From: Omar Sandoval @ 2020-02-11 21:50 UTC (permalink / raw)
  To: Chaitanya Kulkarni; +Cc: linux-block, linux-nvme

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]

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/5 blktests] nvme: test target cntlid min cntlid max
  2020-01-29 23:29 ` [PATCH 2/5 blktests] nvme: test target cntlid min cntlid max Chaitanya Kulkarni
@ 2020-02-11 21:58   ` Omar Sandoval
  0 siblings, 0 replies; 18+ messages in thread
From: Omar Sandoval @ 2020-02-11 21:58 UTC (permalink / raw)
  To: Chaitanya Kulkarni; +Cc: linux-block, linux-nvme

On Wed, Jan 29, 2020 at 03:29:18PM -0800, Chaitanya Kulkarni wrote:
> The new testcases exercises newly added cntlid [min|max] attributes
> for NVMeOF target.
> 
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> ---
>  tests/nvme/033     | 57 ++++++++++++++++++++++++++++++++++++++++++++++
>  tests/nvme/033.out |  4 ++++
>  2 files changed, 61 insertions(+)
>  create mode 100755 tests/nvme/033
>  create mode 100644 tests/nvme/033.out
> 
> diff --git a/tests/nvme/033 b/tests/nvme/033
> new file mode 100755
> index 0000000..97eba7f
> --- /dev/null
> +++ b/tests/nvme/033
> @@ -0,0 +1,57 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0+
> +# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates.
> +#
> +# Test NVMeOF target cntlid[min|max] attributes.
> +
> +. tests/nvme/rc
> +
> +DESCRIPTION="Test NVMeOF target cntlid[min|max] attributes"
> +QUICK=1
> +
> +requires() {
> +	_have_program nvme && _have_modules loop nvme-loop nvmet && \
> +		_have_configfs
> +}
> +
> +test() {
> +	echo "Running ${TEST_NAME}"
> +
> +	_setup_nvmet
> +
> +	local port
> +	local nvmedev
> +	local loop_dev
> +	local cid_min=14
> +	local cid_max=15
> +	local file_path="$TMPDIR/img"
> +	local subsys_name="blktests-subsystem-1"
> +
> +	truncate -s 1G "${file_path}"
> +
> +	loop_dev="$(losetup -f --show "${file_path}")"
> +
> +	_create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \
> +		"91fdba0d-f87b-4c25-b80f-db7be1418b9e" ${cid_min} ${cid_max}
> +	port="$(_create_nvmet_port "loop")"
> +	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
> +
> +	nvme connect -t loop -n "${subsys_name}"
> +
> +	udevadm settle
> +
> +	nvmedev="$(_find_nvme_loop_dev)"
> +	nvme id-ctrl /dev/${nvmedev}n1 | grep cntlid | tr -s ' ' ' '
> +
> +	nvme disconnect -n "${subsys_name}"
> +
> +	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
> +	_remove_nvmet_subsystem "${subsys_name}"
> +	_remove_nvmet_port "${port}"
> +
> +	losetup -d "${loop_dev}"
> +
> +	rm "${file_path}"
> +
> +	echo "Test complete"
> +}

Another shellcheck warning:

tests/nvme/033:44:20: note: Double quote to prevent globbing and word splitting. [SC2086]

Also, this fails on kernels without this feature:

nvme/033 (Test NVMeOF target cntlid[min|max] attributes)     [failed]
    runtime    ...  2.262s
    --- tests/nvme/033.out      2020-02-11 13:52:20.346831467 -0800
    +++ /home/vmuser/repos/blktests/results/nodev/nvme/033.out.bad      2020-02-11 13:52:42.006948791 -0800
    @@ -1,4 +1,4 @@
     Running nvme/033
    -cntlid : e
    +cntlid : 0x1
     NQN:blktests-subsystem-1 disconnected 1 controller(s)
     Test complete

Presumably because _create_nvmet_subsystem silently does nothing if
attr_cntlid_min doesn't exist. We should skip the test if the kernel doesn't
support it rather than ignoring it in _create_nvmet_subsystem.

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/5 blktests] nvme: allow target subsys set model
  2020-01-29 23:29 ` [PATCH 3/5 blktests] nvme: allow target subsys set model Chaitanya Kulkarni
@ 2020-02-11 22:00   ` Omar Sandoval
  2020-02-14  0:58     ` Chaitanya Kulkarni
  2020-02-14  1:11     ` Chaitanya Kulkarni
  0 siblings, 2 replies; 18+ messages in thread
From: Omar Sandoval @ 2020-02-11 22:00 UTC (permalink / raw)
  To: Chaitanya Kulkarni; +Cc: linux-block, linux-nvme

On Wed, Jan 29, 2020 at 03:29:19PM -0800, Chaitanya Kulkarni wrote:
> This patch updates helper function create_nvmet_subsystem() to handle
> newly introduced model attribute.
> 
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> ---
>  tests/nvme/rc | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/tests/nvme/rc b/tests/nvme/rc
> index d1fa796..377c7f7 100644
> --- a/tests/nvme/rc
> +++ b/tests/nvme/rc
> @@ -123,6 +123,7 @@ _create_nvmet_subsystem() {
>  	local uuid=$3
>  	local cntlid_min=$4
>  	local cntlid_max=$5
> +	local model=$6
>  	local cfs_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}"
>  
>  	mkdir -p "${cfs_path}"
> @@ -133,6 +134,9 @@ _create_nvmet_subsystem() {
>  		echo ${cntlid_min} > ${cfs_path}/attr_cntlid_min
>  		echo ${cntlid_max} > ${cfs_path}/attr_cntlid_max
>  	fi

It's not in the git diff context, but the line above is

	if [ $# -eq 5 ] && [ -f ${cfs_path}/attr_cntlid_min ]; then

So if we pass 6 arguments, the cntlid arguments are ignored? These
checks should probably be -ge

> +	if [ $# -eq 6 ] && [ -f ${cfs_path}/attr_model ]; then
> +		echo ${model} > ${cfs_path}/attr_model
> +	fi

More shellcheck warnings about unquoted variables.

>  }
>  
>  _remove_nvmet_ns() {
> -- 
> 2.22.1
> 

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/5 blktests] nvme: test target model attribute
  2020-01-29 23:29 ` [PATCH 4/5 blktests] nvme: test target model attribute Chaitanya Kulkarni
@ 2020-02-11 22:04   ` Omar Sandoval
  0 siblings, 0 replies; 18+ messages in thread
From: Omar Sandoval @ 2020-02-11 22:04 UTC (permalink / raw)
  To: Chaitanya Kulkarni; +Cc: linux-block, linux-nvme

On Wed, Jan 29, 2020 at 03:29:20PM -0800, Chaitanya Kulkarni wrote:
> The new testcases exercises newly added cntlid [min|max] attribute for
> NVMeOF target.

Model, not cntlid, right?

> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> ---
>  tests/nvme/034     | 60 ++++++++++++++++++++++++++++++++++++++++++++++
>  tests/nvme/034.out |  3 +++
>  2 files changed, 63 insertions(+)
>  create mode 100755 tests/nvme/034
>  create mode 100644 tests/nvme/034.out
> 
> diff --git a/tests/nvme/034 b/tests/nvme/034
> new file mode 100755
> index 0000000..1a55ff9
> --- /dev/null
> +++ b/tests/nvme/034
> @@ -0,0 +1,60 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0+
> +# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates.
> +#
> +# Test NVMeOF target cntlid[min|max] attributes.

Same here.

> +. tests/nvme/rc
> +
> +DESCRIPTION="Test NVMeOF target model attribute"
> +QUICK=1
> +
> +requires() {
> +	_have_program nvme && _have_modules loop nvme-loop nvmet && \
> +		_have_configfs
> +}
> +
> +test() {
> +	echo "Running ${TEST_NAME}"
> +
> +	_setup_nvmet
> +
> +	local port
> +	local result
> +	local nvmedev
> +	local loop_dev
> +	local model="test~model"
> +	local file_path="$TMPDIR/img"
> +	local subsys_name="blktests-subsystem-1"
> +
> +	truncate -s 1G "${file_path}"
> +
> +	loop_dev="$(losetup -f --show "${file_path}")"
> +
> +	_create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \
> +		"91fdba0d-f87b-4c25-b80f-db7be1418b9e" 0 100 ${model}

Since the cntlid doesn't matter for this test, maybe you should be able
to pass them as "" "" to _create_nvmet_subsystem so it can ignore them?

> +	port="$(_create_nvmet_port "loop")"
> +	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
> +
> +	nvme connect -t loop -n "${subsys_name}"
> +
> +	udevadm settle
> +
> +	nvmedev="$(_find_nvme_loop_dev)"
> +	nvme list | grep ${nvmedev}n1 | grep -q test~model

Can we do

	nvme list | grep "${nvmedev}n1" | grep -o "$model"

And have that in the test output rather than checking the return value?

> +	result=$?
> +
> +	nvme disconnect -n "${subsys_name}"
> +
> +	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
> +	_remove_nvmet_subsystem "${subsys_name}"
> +	_remove_nvmet_port "${port}"
> +
> +	losetup -d "${loop_dev}"
> +
> +	rm "${file_path}"
> +
> +	if [ ${result} -eq 0 ]; then
> +		echo "Test complete"
> +	fi
> +}
> diff --git a/tests/nvme/034.out b/tests/nvme/034.out
> new file mode 100644
> index 0000000..0a7bd2f
> --- /dev/null
> +++ b/tests/nvme/034.out
> @@ -0,0 +1,3 @@
> +Running nvme/034
> +NQN:blktests-subsystem-1 disconnected 1 controller(s)
> +Test complete
> -- 
> 2.22.1
> 

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 5/5 blktests] nvme: make new testcases backward compatible
  2020-01-29 23:29 ` [PATCH 5/5 blktests] nvme: make new testcases backward compatible Chaitanya Kulkarni
@ 2020-02-11 22:06   ` Omar Sandoval
  2020-02-11 22:18     ` Chaitanya Kulkarni
  0 siblings, 1 reply; 18+ messages in thread
From: Omar Sandoval @ 2020-02-11 22:06 UTC (permalink / raw)
  To: Chaitanya Kulkarni; +Cc: linux-block, linux-nvme

On Wed, Jan 29, 2020 at 03:29:21PM -0800, Chaitanya Kulkarni wrote:
> This patch makes newly added testcases backward compatible with
> right value setting into the SKIP_REASON variable.

Oh! These should be part of the new tests from the start. Please
reorganize the series.

> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> ---
>  tests/nvme/033 | 60 +++++++++++++++++++++++++++-----------------------
>  tests/nvme/034 | 59 ++++++++++++++++++++++++++-----------------------
>  tests/nvme/rc  | 27 +++++++++++++++++------
>  3 files changed, 83 insertions(+), 63 deletions(-)
> 
> diff --git a/tests/nvme/033 b/tests/nvme/033
> index 97eba7f..db5ded3 100755
> --- a/tests/nvme/033
> +++ b/tests/nvme/033
> @@ -9,49 +9,53 @@
>  DESCRIPTION="Test NVMeOF target cntlid[min|max] attributes"
>  QUICK=1
>  
> +PORT=""
> +NVMEDEV=""
> +LOOP_DEV=""
> +FILE_PATH="$TMPDIR/img"
> +SUBSYS_NAME="blktests-subsystem-1"
> +
> +_have_cid_min_max()
> +{
> +	local cid_min=14
> +	local cid_max=15
> +
> +	_setup_nvmet
> +	truncate -s 1G "${FILE_PATH}"
> +	LOOP_DEV="$(losetup -f --show "${FILE_PATH}")"
> +
> +	# we can only know skip reason when we create a subsys
> +	 _create_nvmet_subsystem "${SUBSYS_NAME}" "${LOOP_DEV}" \
> +		"91fdba0d-f87b-4c25-b80f-db7be1418b9e" ${cid_min} ${cid_max}
> +}
> +
>  requires() {
>  	_have_program nvme && _have_modules loop nvme-loop nvmet && \
> -		_have_configfs
> +		_have_configfs && _have_cid_min_max
>  }
>  
>  test() {
>  	echo "Running ${TEST_NAME}"
>  
> -	_setup_nvmet
> -
> -	local port
> -	local nvmedev
> -	local loop_dev
> -	local cid_min=14
> -	local cid_max=15
> -	local file_path="$TMPDIR/img"
> -	local subsys_name="blktests-subsystem-1"
> -
> -	truncate -s 1G "${file_path}"
> -
> -	loop_dev="$(losetup -f --show "${file_path}")"
> -
> -	_create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \
> -		"91fdba0d-f87b-4c25-b80f-db7be1418b9e" ${cid_min} ${cid_max}
> -	port="$(_create_nvmet_port "loop")"
> -	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
> +	PORT="$(_create_nvmet_port "loop")"
> +	_add_nvmet_subsys_to_port "${PORT}" "${SUBSYS_NAME}"
>  
> -	nvme connect -t loop -n "${subsys_name}"
> +	nvme connect -t loop -n "${SUBSYS_NAME}"
>  
>  	udevadm settle
>  
> -	nvmedev="$(_find_nvme_loop_dev)"
> -	nvme id-ctrl /dev/${nvmedev}n1 | grep cntlid | tr -s ' ' ' '
> +	NVMEDEV="$(_find_nvme_loop_dev)"
> +	nvme id-ctrl /dev/${NVMEDEV}n1 | grep cntlid | tr -s ' ' ' '
>  
> -	nvme disconnect -n "${subsys_name}"
> +	nvme disconnect -n "${SUBSYS_NAME}"
>  
> -	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
> -	_remove_nvmet_subsystem "${subsys_name}"
> -	_remove_nvmet_port "${port}"
> +	_remove_nvmet_subsystem_from_port "${PORT}" "${SUBSYS_NAME}"
> +	_remove_nvmet_subsystem "${SUBSYS_NAME}"
> +	_remove_nvmet_port "${PORT}"
>  
> -	losetup -d "${loop_dev}"
> +	losetup -d "${LOOP_DEV}"
>  
> -	rm "${file_path}"
> +	rm "${FILE_PATH}"
>  
>  	echo "Test complete"
>  }
> diff --git a/tests/nvme/034 b/tests/nvme/034
> index 1a55ff9..39d833f 100755
> --- a/tests/nvme/034
> +++ b/tests/nvme/034
> @@ -9,50 +9,53 @@
>  DESCRIPTION="Test NVMeOF target model attribute"
>  QUICK=1
>  
> +PORT=""
> +NVMEDEV=""
> +LOOP_DEV=""
> +FILE_PATH="$TMPDIR/img"
> +SUBSYS_NAME="blktests-subsystem-1"
> +
> +_have_model()
> +{
> +	local model="test~model"
> +
> +	_setup_nvmet
> +	truncate -s 1G "${FILE_PATH}"
> +	LOOP_DEV="$(losetup -f --show "${FILE_PATH}")"
> +
> +	# we can only know skip reason when we create a subsys
> +	 _create_nvmet_subsystem "${SUBSYS_NAME}" "${LOOP_DEV}" \
> +		"91fdba0d-f87b-4c25-b80f-db7be1418b9e" 14 15 \
> +		${model}
> +}
>  requires() {
>  	_have_program nvme && _have_modules loop nvme-loop nvmet && \
> -		_have_configfs
> +		_have_configfs && _have_model
>  }
>  
>  test() {
>  	echo "Running ${TEST_NAME}"
>  
> -	_setup_nvmet
> -
> -	local port
> -	local result
> -	local nvmedev
> -	local loop_dev
> -	local model="test~model"
> -	local file_path="$TMPDIR/img"
> -	local subsys_name="blktests-subsystem-1"
> -
> -	truncate -s 1G "${file_path}"
> -
> -	loop_dev="$(losetup -f --show "${file_path}")"
> -
> -	_create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \
> -		"91fdba0d-f87b-4c25-b80f-db7be1418b9e" 0 100 ${model}
> -	port="$(_create_nvmet_port "loop")"
> -	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
> +	PORT="$(_create_nvmet_port "loop")"
> +	_add_nvmet_subsys_to_port "${PORT}" "${SUBSYS_NAME}"
>  
> -	nvme connect -t loop -n "${subsys_name}"
> +	nvme connect -t loop -n "${SUBSYS_NAME}"
>  
>  	udevadm settle
>  
> -	nvmedev="$(_find_nvme_loop_dev)"
> -	nvme list | grep ${nvmedev}n1 | grep -q test~model
> +	NVMEDEV="$(_find_nvme_loop_dev)"
> +	nvme list | grep ${NVMEDEV}n1 | grep -q test~model
>  	result=$?
>  
> -	nvme disconnect -n "${subsys_name}"
> +	nvme disconnect -n "${SUBSYS_NAME}"
>  
> -	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
> -	_remove_nvmet_subsystem "${subsys_name}"
> -	_remove_nvmet_port "${port}"
> +	_remove_nvmet_subsystem_from_port "${PORT}" "${SUBSYS_NAME}"
> +	_remove_nvmet_subsystem "${SUBSYS_NAME}"
> +	_remove_nvmet_port "${PORT}"
>  
> -	losetup -d "${loop_dev}"
> +	losetup -d "${LOOP_DEV}"
>  
> -	rm "${file_path}"
> +	rm "${FILE_PATH}"
>  
>  	if [ ${result} -eq 0 ]; then
>  		echo "Test complete"
> diff --git a/tests/nvme/rc b/tests/nvme/rc
> index 377c7f7..77bafd8 100644
> --- a/tests/nvme/rc
> +++ b/tests/nvme/rc
> @@ -128,15 +128,28 @@ _create_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
> +	if [ $# -eq 5 ]; then
> +		if [ -f ${cfs_path}/attr_cntlid_min ]; then
> +			echo ${cntlid_min} > ${cfs_path}/attr_cntlid_min
> +			echo ${cntlid_max} > ${cfs_path}/attr_cntlid_max
> +		else
> +			SKIP_REASON="attr_cntlid_[min|max] not found"
> +			rmdir "${cfs_path}"
> +			return 1
> +		fi
>  	fi
> -	if [ $# -eq 6 ] && [ -f ${cfs_path}/attr_model ]; then
> -		echo ${model} > ${cfs_path}/attr_model
> +	if [ $# -eq 6 ]; then
> +		if [ -f ${cfs_path}/attr_model ]; then
> +			echo ${model} > ${cfs_path}/attr_model
> +		else
> +			SKIP_REASON="attr_cntlid_model not found"
> +			rmdir "${cfs_path}"
> +			return 1
> +		fi
>  	fi
> +	_create_nvmet_ns "${nvmet_subsystem}" "1" "${blkdev}" "${uuid}"
> +
> +	return 0
>  }
>  
>  _remove_nvmet_ns() {
> -- 
> 2.22.1
> 

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/5 blktest] nvme: add cntlid and model testcases
  2020-02-11 16:46   ` Chaitanya Kulkarni
@ 2020-02-11 22:07     ` Omar Sandoval
  2020-02-11 22:17       ` Chaitanya Kulkarni
  0 siblings, 1 reply; 18+ messages in thread
From: Omar Sandoval @ 2020-02-11 22:07 UTC (permalink / raw)
  To: Chaitanya Kulkarni; +Cc: linux-block, Omar Sandoval, linux-nvme

On Tue, Feb 11, 2020 at 04:46:05PM +0000, Chaitanya Kulkarni wrote:
> Ping ?

Whoops sorry, these don't match my email filter that looks for "PATCH
blktests" so I missed them. (You can make git do that for you with git
format-patch --subject-prefix="PATCH blktests", by the way.)

Thanks!

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/5 blktest] nvme: add cntlid and model testcases
  2020-02-11 22:07     ` Omar Sandoval
@ 2020-02-11 22:17       ` Chaitanya Kulkarni
  0 siblings, 0 replies; 18+ messages in thread
From: Chaitanya Kulkarni @ 2020-02-11 22:17 UTC (permalink / raw)
  To: Omar Sandoval; +Cc: linux-block, Omar Sandoval, linux-nvme

On 02/11/2020 02:07 PM, Omar Sandoval wrote:
> Whoops sorry, these don't match my email filter that looks for "PATCH
> blktests" so I missed them. (You can make git do that for you with git
> format-patch --subject-prefix="PATCH blktests", by the way.)

Okay, by bad, missed the PATCH before blktests.

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 5/5 blktests] nvme: make new testcases backward compatible
  2020-02-11 22:06   ` Omar Sandoval
@ 2020-02-11 22:18     ` Chaitanya Kulkarni
  0 siblings, 0 replies; 18+ messages in thread
From: Chaitanya Kulkarni @ 2020-02-11 22:18 UTC (permalink / raw)
  To: Omar Sandoval; +Cc: linux-block, linux-nvme

On 02/11/2020 02:06 PM, Omar Sandoval wrote:
> On Wed, Jan 29, 2020 at 03:29:21PM -0800, Chaitanya Kulkarni wrote:
>> >This patch makes newly added testcases backward compatible with
>> >right value setting into the SKIP_REASON variable.
> Oh! These should be part of the new tests from the start. Please
> reorganize the series.
>
Okay, I kept it simple so that easy to review test-cases first,
I'll do the prep patch, and send out again.

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/5 blktests] nvme: allow target subsys set model
  2020-02-11 22:00   ` Omar Sandoval
@ 2020-02-14  0:58     ` Chaitanya Kulkarni
  2020-02-14  1:11     ` Chaitanya Kulkarni
  1 sibling, 0 replies; 18+ messages in thread
From: Chaitanya Kulkarni @ 2020-02-14  0:58 UTC (permalink / raw)
  To: Omar Sandoval; +Cc: linux-block, linux-nvme

On 02/11/2020 02:00 PM, Omar Sandoval wrote:
>>
>> >  	mkdir -p "${cfs_path}"
>> >@@ -133,6 +134,9 @@ _create_nvmet_subsystem() {
>> >  		echo ${cntlid_min} > ${cfs_path}/attr_cntlid_min
>> >  		echo ${cntlid_max} > ${cfs_path}/attr_cntlid_max
>> >  	fi
> It's not in the git diff context, but the line above is
>
> 	if [ $# -eq 5 ] && [ -f ${cfs_path}/attr_cntlid_min ]; then
>
> So if we pass 6 arguments, the cntlid arguments are ignored? These
> checks should probably be -ge
>

Yes, -eq forces caller to test cntlid exclusive (without model),
that was the intent here to either test cntlid or model. In this
way caller can pass 0 or "" and that will be ignored. with -ge
then caller has to pass meaningful value and set it properly.

Do we still want to make it to -ge ?

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/5 blktests] nvme: allow target subsys set model
  2020-02-11 22:00   ` Omar Sandoval
  2020-02-14  0:58     ` Chaitanya Kulkarni
@ 2020-02-14  1:11     ` Chaitanya Kulkarni
  1 sibling, 0 replies; 18+ messages in thread
From: Chaitanya Kulkarni @ 2020-02-14  1:11 UTC (permalink / raw)
  To: Omar Sandoval; +Cc: linux-block, linux-nvme

On 02/11/2020 02:00 PM, Omar Sandoval wrote:
>>   	fi
> It's not in the git diff context, but the line above is
>
> 	if [ $# -eq 5 ] && [ -f ${cfs_path}/attr_cntlid_min ]; then
>
> So if we pass 6 arguments, the cntlid arguments are ignored? These
> checks should probably be -ge
>

With the -ge change it will also print wrong skip reason for 034
I remember now I think that is the reason why kept it -eq :-

Here is with -ge :-

blktests (master) # ./check tests/nvme/033
nvme/033 (Test NVMeOF target cntlid[min|max] attributes)     [not run]
     attr_cntlid_[min|max] not found
blktests (master) # ./check tests/nvme/034
nvme/034 (Test NVMeOF target model attribute)                [not run]
     attr_cntlid_[min|max] not found

With -eq :-

blktests (master) # ./check tests/nvme/033
nvme/033 (Test NVMeOF target cntlid[min|max] attributes)     [not run]
     attr_cntlid_[min|max] not found
blktests (master) # ./check tests/nvme/034
nvme/034 (Test NVMeOF target model attribute)                [not run]
     attr_model not found








_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, back to index

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-29 23:29 [PATCH 0/5 blktest] nvme: add cntlid and model testcases Chaitanya Kulkarni
2020-01-29 23:29 ` [PATCH 1/5 blktests] nvme: allow target subsys set cntlid min/max Chaitanya Kulkarni
2020-02-11 21:50   ` Omar Sandoval
2020-01-29 23:29 ` [PATCH 2/5 blktests] nvme: test target cntlid min cntlid max Chaitanya Kulkarni
2020-02-11 21:58   ` Omar Sandoval
2020-01-29 23:29 ` [PATCH 3/5 blktests] nvme: allow target subsys set model Chaitanya Kulkarni
2020-02-11 22:00   ` Omar Sandoval
2020-02-14  0:58     ` Chaitanya Kulkarni
2020-02-14  1:11     ` Chaitanya Kulkarni
2020-01-29 23:29 ` [PATCH 4/5 blktests] nvme: test target model attribute Chaitanya Kulkarni
2020-02-11 22:04   ` Omar Sandoval
2020-01-29 23:29 ` [PATCH 5/5 blktests] nvme: make new testcases backward compatible Chaitanya Kulkarni
2020-02-11 22:06   ` Omar Sandoval
2020-02-11 22:18     ` Chaitanya Kulkarni
2020-02-03 22:48 ` [PATCH 0/5 blktest] nvme: add cntlid and model testcases Chaitanya Kulkarni
2020-02-11 16:46   ` Chaitanya Kulkarni
2020-02-11 22:07     ` Omar Sandoval
2020-02-11 22:17       ` Chaitanya Kulkarni

Linux-NVME Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-nvme/0 linux-nvme/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-nvme linux-nvme/ https://lore.kernel.org/linux-nvme \
		linux-nvme@lists.infradead.org
	public-inbox-index linux-nvme

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-nvme


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git