Skip to contentSkip to conversation

nvme: new testcases for NVMeOF

PATCH New Chaitanya Kulkarni 2 participants 15 messages Sep 4, 2018 – Sep 12, 2018 NVMe

lore
Share & tools
lore
#0 lore raw

v2 cover nvme: new testcases for NVMeOF

Hi,

This adds Dataset Management, write-zeroes, smart-log and several small command specitic new testcases for block device and file backed namespace when NVMeOF target is configured with loop mode (nvme-loop.ko).

Please note that I'm leaving out "018" for Hannes's ANA realted testcase :-
http://lists.infradead.org/pipermail/linux-nvme/2018-August/019553.html.

Regards,
Chaitanya

Changes since V1:-

1. Addition of new testcases.
2. Test the code on 4.19.0-rc2.

# git log -12 --oneline
bcdac08 (HEAD -> master) nvme: add NVMeOF reset test for file-ns
4455a3a nvme: add NVMeOF list test for file-ns
0cb2c82 nvme: add NVMeOF list-subsys test for file-ns
249883d nvme: add NVMeOF ns-rescan test for file-ns
c8f1876 nvme: add NVMeOF ns-desc test for file-ns
5972074 nvme: add NVMeOF effects-log test for file-ns
d5b2ef4 nvme: add NVMeOF smart-log test for file-ns
5bd0bee nvme: add NVMeOF smart-log test for bdev-ns
c749e08 nvme: add NVMeOF write-zeroes test for file-ns
3ef94d3 nvme: add NVMeOF write-zeroes test for bdev-ns
140833b nvme: add NVMeOF DSM discard test for file-ns
cb52922 nvme: add NVMeOF DSM discard test for bdev-ns

nvme/019 (test NVMe DSM Discard command on NVMeOF block-device ns) [passed]

    runtime  0.818s  ...  0.832s
nvme/020 (test NVMe DSM Discard command on NVMeOF file-backed ns) [passed]
    runtime  0.767s  ...  0.766s
nvme/021 (test NVMe write-zeroes command on NVMeOF block-device ns) [passed]
    runtime  0.819s  ...  0.819s
nvme/022 (test NVMe write-zeroes command on NVMeOF file-backed ns) [passed]
    runtime  0.782s  ...  0.770s
nvme/023 (test NVMe smart-log command on NVMeOF block-device ns) [passed]
    runtime  0.815s  ...  0.823s
nvme/024 (test NVMe smart-log command on NVMeOF file-backed ns) [passed]
    runtime  0.776s  ...  0.773s
nvme/025 (test NVMe effects-log command on NVMeOF file-backed ns) [passed]
    runtime  0.783s  ...  0.753s
nvme/026 (test NVMe ns-descs command on NVMeOF file-backed ns) [passed]
    runtime  0.774s  ...  0.766s
nvme/027 (test NVMe ns-rescan command on NVMeOF file-backed ns) [passed]
    runtime  0.783s  ...  0.784s
nvme/028 (test NVMe list-subsys command on NVMeOF file-backed ns) [passed]
    runtime  0.772s  ...  0.775s
nvme/029 (test NVMe list command on NVMeOF file-backed ns)   [passed]
    runtime  0.768s  ...  0.760s
nvme/030 (test NVMe reset command on NVMeOF file-backed ns)  [passed]
    runtime  1.026s  ...  1.003s

Chaitanya Kulkarni (12):
nvme: add NVMeOF DSM discard test for bdev-ns
nvme: add NVMeOF DSM discard test for file-ns
nvme: add NVMeOF write-zeroes test for bdev-ns
nvme: add NVMeOF write-zeroes test for file-ns
nvme: add NVMeOF smart-log test for bdev-ns
nvme: add NVMeOF smart-log test for file-ns
nvme: add NVMeOF effects-log test for file-ns
nvme: add NVMeOF ns-desc test for file-ns
nvme: add NVMeOF ns-rescan test for file-ns
nvme: add NVMeOF list-subsys test for file-ns
nvme: add NVMeOF list test for file-ns
nvme: add NVMeOF reset test for file-ns

 tests/nvme/019     | 78 +++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/019.out |  6 ++++
 tests/nvme/020     | 72 ++++++++++++++++++++++++++++++++++++++++
 tests/nvme/020.out |  6 ++++
 tests/nvme/021     | 78 +++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/021.out |  6 ++++
 tests/nvme/022     | 72 ++++++++++++++++++++++++++++++++++++++++
 tests/nvme/022.out |  6 ++++
 tests/nvme/023     | 82 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/023.out |  5 +++
 tests/nvme/024     | 77 +++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/024.out |  5 +++
 tests/nvme/025     | 77 +++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/025.out |  5 +++
 tests/nvme/026     | 77 +++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/026.out |  5 +++
 tests/nvme/027     | 77 +++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/027.out |  5 +++
 tests/nvme/028     | 77 +++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/028.out |  5 +++
 tests/nvme/029     | 77 +++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/029.out |  5 +++
 tests/nvme/030     | 77 +++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/030.out |  5 +++
 24 files changed, 985 insertions(+)
 create mode 100755 tests/nvme/019
 create mode 100644 tests/nvme/019.out
 create mode 100755 tests/nvme/020
 create mode 100644 tests/nvme/020.out
 create mode 100755 tests/nvme/021
 create mode 100644 tests/nvme/021.out
 create mode 100755 tests/nvme/022
 create mode 100644 tests/nvme/022.out
 create mode 100755 tests/nvme/023
 create mode 100644 tests/nvme/023.out
 create mode 100755 tests/nvme/024
 create mode 100644 tests/nvme/024.out
 create mode 100755 tests/nvme/025
 create mode 100644 tests/nvme/025.out
 create mode 100755 tests/nvme/026
 create mode 100644 tests/nvme/026.out
 create mode 100755 tests/nvme/027
 create mode 100644 tests/nvme/027.out
 create mode 100755 tests/nvme/028
 create mode 100644 tests/nvme/028.out
 create mode 100755 tests/nvme/029
 create mode 100644 tests/nvme/029.out
 create mode 100755 tests/nvme/030
 create mode 100644 tests/nvme/030.out
Signature · 1 line
2.17.0
#1 lore raw

PATCH v2 1/12 nvme: add NVMeOF DSM discard test for bdev-ns

Signed-off-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 tests/nvme/019     | 78 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/019.out |  6 ++++
 2 files changed, 84 insertions(+)
 create mode 100755 tests/nvme/019
 create mode 100644 tests/nvme/019.out
tests/nvme/019 new file +78 -0
new file mode 100755
index 0000000..b180369
@@ -0,0 +1,78 @@
+#!/bin/bash
+# Test NVMe DSM Discard command on NVMeOF with a block-device ns.
+# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.
+#
+#   Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+
+. tests/nvme/rc
+
+DESCRIPTION="test NVMe DSM Discard command on NVMeOF block-device ns"
+QUICK=1
+
+requires() {
+	_have_program nvme && _have_module nvme-loop && _have_module loop && \
+		_have_module nvmet && _have_configfs
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	modprobe nvmet
+	modprobe nvme-loop
+
+	local port
+	local nvmedev
+	local loop_dev
+	local file_path="$TMPDIR/img"
+	local subsys_name="blktests-subsystem-1"
+	local nblk_range="10,10,10,10,10,10,10,10,10,10"
+	local sblk_range="100,200,300,400,500,600,700,800,900,1000"
+
+	truncate -s 1G "${file_path}"
+
+	loop_dev="$(losetup -f --show "${file_path}")"
+
+	_create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \
+		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
+	port="$(_create_nvmet_port "loop")"
+	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+
+	nvme connect -t loop -n "${subsys_name}"
+
+	nvmedev="$(_find_nvme_loop_dev)"
+	cat "/sys/block/${nvmedev}n1/uuid"
+	cat "/sys/block/${nvmedev}n1/wwid"
+
+	nvme dsm "/dev/${nvmedev}" -n 1 -d -s "${sblk_range}" -b "${nblk_range}"
+
+	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 -f "${file_path}"
+
+	modprobe -r nvme-loop
+	modprobe -r nvmet
+
+	echo "Test complete"
+}
tests/nvme/019.out new file +6 -0
new file mode 100644
index 0000000..3e649a4
@@ -0,0 +1,6 @@
+Running nvme/019
+91fdba0d-f87b-4c25-b80f-db7be1418b9e
+uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
+NVMe DSM: success
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Test complete
Signature · 1 line
2.17.0
#2 lore raw

PATCH v2 2/12 nvme: add NVMeOF DSM discard test for file-ns

In reply to Chaitanya Kulkarni
Signed-off-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 tests/nvme/020     | 72 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/020.out |  6 ++++
 2 files changed, 78 insertions(+)
 create mode 100755 tests/nvme/020
 create mode 100644 tests/nvme/020.out
tests/nvme/020 new file +72 -0
new file mode 100755
index 0000000..fcf68df
@@ -0,0 +1,72 @@
+#!/bin/bash
+# Test NVMe DSM Discard command on NVMeOF with a file-backed ns.
+# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.
+#
+#   Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+
+. tests/nvme/rc
+
+DESCRIPTION="test NVMe DSM Discard command on NVMeOF file-backed ns"
+QUICK=1
+
+requires() {
+	_have_program nvme && _have_module nvme-loop && _have_configfs \
+		_have_module nvmet
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	modprobe nvmet
+	modprobe nvme-loop
+
+	local port
+	local nvmedev
+	local file_path="$TMPDIR/img"
+	local subsys_name="blktests-subsystem-1"
+	local nblk_range="10,10,10,10,10,10,10,10,10,10"
+	local sblk_range="100,200,300,400,500,600,700,800,900,1000"
+
+	truncate -s 1G "${file_path}"
+
+	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
+		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
+	port="$(_create_nvmet_port "loop")"
+	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+
+	nvme connect -t loop -n "${subsys_name}"
+
+	nvmedev="$(_find_nvme_loop_dev)"
+	cat "/sys/block/${nvmedev}n1/uuid"
+	cat "/sys/block/${nvmedev}n1/wwid"
+
+	nvme dsm "/dev/${nvmedev}" -n 1 -d -s "${sblk_range}" -b "${nblk_range}"
+
+	nvme disconnect -n "${subsys_name}"
+
+	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
+	_remove_nvmet_subsystem "${subsys_name}"
+	_remove_nvmet_port "${port}"
+
+	rm -f "${file_path}"
+
+	modprobe -r nvme-loop
+	modprobe -r nvmet
+	echo "Test complete"
+}
tests/nvme/020.out new file +6 -0
new file mode 100644
index 0000000..113c177
@@ -0,0 +1,6 @@
+Running nvme/020
+91fdba0d-f87b-4c25-b80f-db7be1418b9e
+uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
+NVMe DSM: success
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Test complete
Signature · 1 line
2.17.0
#3 lore raw

PATCH v2 3/12 nvme: add NVMeOF write-zeroes test for bdev-ns

In reply to Chaitanya Kulkarni
Signed-off-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 tests/nvme/021     | 78 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/021.out |  6 ++++
 2 files changed, 84 insertions(+)
 create mode 100755 tests/nvme/021
 create mode 100644 tests/nvme/021.out
tests/nvme/021 new file +78 -0
new file mode 100755
index 0000000..efcbb3f
@@ -0,0 +1,78 @@
+#!/bin/bash
+# Test NVMe write-zeroes command on NVMeOF with a block-device ns.
+# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.
+#
+#   Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+
+. tests/nvme/rc
+
+DESCRIPTION="test NVMe write-zeroes command on NVMeOF block-device ns"
+QUICK=1
+
+requires() {
+	_have_program nvme && _have_module nvme-loop && _have_module loop && \
+		_have_module nvmet && _have_configfs
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	modprobe nvmet
+	modprobe nvme-loop
+
+	local port
+	local nvmedev
+	local loop_dev
+	local file_path="$TMPDIR/img"
+	local subsys_name="blktests-subsystem-1"
+	local sblk=0
+	local nblk=99
+
+	truncate -s 1G "${file_path}"
+
+	loop_dev="$(losetup -f --show "${file_path}")"
+
+	_create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \
+		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
+	port="$(_create_nvmet_port "loop")"
+	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+
+	nvme connect -t loop -n "${subsys_name}"
+
+	nvmedev="$(_find_nvme_loop_dev)"
+	cat "/sys/block/${nvmedev}n1/uuid"
+	cat "/sys/block/${nvmedev}n1/wwid"
+
+	nvme write-zeroes "/dev/${nvmedev}" -n 1 -d -s "${sblk}" -c "${nblk}"
+
+	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 -f "${file_path}"
+
+	modprobe -r nvme-loop
+	modprobe -r nvmet
+
+	echo "Test complete"
+}
tests/nvme/021.out new file +6 -0
new file mode 100644
index 0000000..29939e6
@@ -0,0 +1,6 @@
+Running nvme/021
+91fdba0d-f87b-4c25-b80f-db7be1418b9e
+uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
+NVME Write Zeroes Success
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Test complete
Signature · 1 line
2.17.0
#4 lore raw

PATCH v2 3/12 nvme: add NVMeOF write-zeroes test for bdev-ns

Quoted 7 lines · Chaitanya Kulkarni
Signed-off-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 tests/nvme/021     | 78 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/021.out |  6 ++++
 2 files changed, 84 insertions(+)
 create mode 100755 tests/nvme/021
 create mode 100644 tests/nvme/021.out

This test is still failing for me sometimes. If I apply the following patch:

tests/nvme/021 +4 -0
index efcbb3f..137e89e 100755
@@ -59,6 +59,10 @@ test() {
 	cat "/sys/block/${nvmedev}n1/uuid"
 	cat "/sys/block/${nvmedev}n1/wwid"
 
+	nvme write-zeroes "/dev/${nvmedev}" -n 1 -d -s "${sblk}" -c "${nblk}"
+	nvme write-zeroes "/dev/${nvmedev}" -n 1 -d -s "${sblk}" -c "${nblk}"
+	nvme write-zeroes "/dev/${nvmedev}" -n 1 -d -s "${sblk}" -c "${nblk}"
+	nvme write-zeroes "/dev/${nvmedev}" -n 1 -d -s "${sblk}" -c "${nblk}"
 	nvme write-zeroes "/dev/${nvmedev}" -n 1 -d -s "${sblk}" -c "${nblk}"
 
 	nvme disconnect -n "${subsys_name}"
tests/nvme/021.out +4 -0
index 29939e6..658be05 100644
@@ -2,5 +2,9 @@ Running nvme/021
 91fdba0d-f87b-4c25-b80f-db7be1418b9e
 uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
 NVME Write Zeroes Success
+NVME Write Zeroes Success
+NVME Write Zeroes Success
+NVME Write Zeroes Success
+NVME Write Zeroes Success
 NQN:blktests-subsystem-1 disconnected 1 controller(s)
 Test complete

Then some of the commands pass and some fail:

home/vmuser/linux/blktests/results/nodev/nvme/021.out.bad renamed from nvme/021.out +3 -3
@@ -1,10 +1,10 @@
 Running nvme/021
 91fdba0d-f87b-4c25-b80f-db7be1418b9e
 uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
+NVME IO command error:Unknown(400f)
 NVME Write Zeroes Success
+NVME IO command error:Unknown(400f)
 NVME Write Zeroes Success
-NVME Write Zeroes Success
-NVME Write Zeroes Success
-NVME Write Zeroes Success
+NVME IO command error:Unknown(400f)
 NQN:blktests-subsystem-1 disconnected 1 controller(s)
 Test complete

I'll look a bit more, but do you know what might be causing this? This is on v4.19-rc3 with nvme-cli 1.6.
using nvme

#5 lore raw

PATCH v2 3/12 nvme: add NVMeOF write-zeroes test for bdev-ns

Let me test again, I'll send out the next version with the fix.

From: Omar Sandoval <[email protected]>
Sent: Wednesday, September 12, 2018 3:37 PM
To: Chaitanya Kulkarni
Cc: linux-nvme at lists.infradead.org; osandov at fb.com
Subject: Re: [PATCH V2 blktests 03/12] nvme: add NVMeOF write-zeroes test for bdev-ns ?

Quoted 7 lines · Chaitanya Kulkarni
Signed-off-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>

---
? tests/nvme/021???? | 78 ++++++++++++++++++++++++++++++++++++++++++++++ ? tests/nvme/021.out |? 6 ++++
? 2 files changed, 84 insertions(+)
? create mode 100755 tests/nvme/021
? create mode 100644 tests/nvme/021.out

This test is still failing for me sometimes. If I apply the following patch:

tests/nvme/021 +0 -0
index efcbb3f..137e89e 100755
@@ -59,6 +59,10 @@ test() {

???????? cat "/sys/block/${nvmedev}n1/uuid"
???????? cat "/sys/block/${nvmedev}n1/wwid"
?
+?????? nvme write-zeroes "/dev/${nvmedev}" -n 1 -d -s "${sblk}" -c "${nblk}" +?????? nvme write-zeroes "/dev/${nvmedev}" -n 1 -d -s "${sblk}" -c "${nblk}" +?????? nvme write-zeroes "/dev/${nvmedev}" -n 1 -d -s "${sblk}" -c "${nblk}" +?????? nvme write-zeroes "/dev/${nvmedev}" -n 1 -d -s "${sblk}" -c "${nblk}" ???????? nvme write-zeroes "/dev/${nvmedev}" -n 1 -d -s "${sblk}" -c "${nblk}" ?
???????? nvme disconnect -n "${subsys_name}"

tests/nvme/021.out +0 -0
index 29939e6..658be05 100644
@@ -2,5 +2,9 @@ Running nvme/021

?91fdba0d-f87b-4c25-b80f-db7be1418b9e ?uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e ?NVME Write Zeroes Success
+NVME Write Zeroes Success
+NVME Write Zeroes Success
+NVME Write Zeroes Success
+NVME Write Zeroes Success ?NQN:blktests-subsystem-1 disconnected 1 controller(s) ?Test complete

Then some of the commands pass and some fail:

home/vmuser/linux/blktests/results/nodev/nvme/021.out.bad? 2018-09-12 15:30:43.037900569 -0700 renamed from nvme/021.out? 2018-09-12 14:41:29.563976539 -0700 +0 -0
@@ -1,10 +1,10 @@

?Running nvme/021 ?91fdba0d-f87b-4c25-b80f-db7be1418b9e ?uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e +NVME IO command error:Unknown(400f)
?NVME Write Zeroes Success
+NVME IO command error:Unknown(400f)
?NVME Write Zeroes Success
-NVME Write Zeroes Success
-NVME Write Zeroes Success
-NVME Write Zeroes Success
+NVME IO command error:Unknown(400f) ?NQN:blktests-subsystem-1 disconnected 1 controller(s) ?Test complete

I'll look a bit more, but do you know what might be causing this? This is on v4.19-rc3 with nvme-cli 1.6.
using nvme

#6 lore raw

PATCH v2 4/12 nvme: add NVMeOF write-zeroes test for file-ns

In reply to Chaitanya Kulkarni
Signed-off-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 tests/nvme/022     | 72 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/022.out |  6 ++++
 2 files changed, 78 insertions(+)
 create mode 100755 tests/nvme/022
 create mode 100644 tests/nvme/022.out
tests/nvme/022 new file +72 -0
new file mode 100755
index 0000000..952f140
@@ -0,0 +1,72 @@
+#!/bin/bash
+# Test NVMe write-zeroes command on NVMeOF with a file-backed ns.
+# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.
+#
+#   Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+
+. tests/nvme/rc
+
+DESCRIPTION="test NVMe write-zeroes command on NVMeOF file-backed ns"
+QUICK=1
+
+requires() {
+	_have_program nvme && _have_module nvme-loop && _have_configfs \
+		_have_module nvmet
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	modprobe nvmet
+	modprobe nvme-loop
+
+	local port
+	local nvmedev
+	local file_path="$TMPDIR/img"
+	local subsys_name="blktests-subsystem-1"
+	local sblk=0
+	local nblk=99
+
+	truncate -s 1G "${file_path}"
+
+	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
+		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
+	port="$(_create_nvmet_port "loop")"
+	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+
+	nvme connect -t loop -n "${subsys_name}"
+
+	nvmedev="$(_find_nvme_loop_dev)"
+	cat "/sys/block/${nvmedev}n1/uuid"
+	cat "/sys/block/${nvmedev}n1/wwid"
+
+	nvme write-zeroes "/dev/${nvmedev}" -n 1 -d -s "${sblk}" -c "${nblk}"
+
+	nvme disconnect -n "${subsys_name}"
+
+	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
+	_remove_nvmet_subsystem "${subsys_name}"
+	_remove_nvmet_port "${port}"
+
+	rm -f "${file_path}"
+
+	modprobe -r nvme-loop
+	modprobe -r nvmet
+	echo "Test complete"
+}
tests/nvme/022.out new file +6 -0
new file mode 100644
index 0000000..d2a0606
@@ -0,0 +1,6 @@
+Running nvme/022
+91fdba0d-f87b-4c25-b80f-db7be1418b9e
+uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
+NVME Write Zeroes Success
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Test complete
Signature · 1 line
2.17.0
#7 lore raw

PATCH v2 5/12 nvme: add NVMeOF smart-log test for bdev-ns

In reply to Chaitanya Kulkarni
Signed-off-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 tests/nvme/023     | 82 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/023.out |  5 +++
 2 files changed, 87 insertions(+)
 create mode 100755 tests/nvme/023
 create mode 100644 tests/nvme/023.out
tests/nvme/023 new file +82 -0
new file mode 100755
index 0000000..5d2b36b
@@ -0,0 +1,82 @@
+#!/bin/bash
+# Test NVMe smart-log command on NVMeOF with a block-device ns.
+# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.
+#
+#   Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+
+. tests/nvme/rc
+
+DESCRIPTION="test NVMe smart-log command on NVMeOF block-device ns"
+QUICK=1
+
+requires() {
+	_have_program nvme && _have_module nvme-loop && _have_module loop && \
+		_have_module nvmet && _have_configfs
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	modprobe nvmet
+	modprobe nvme-loop
+
+	local port
+	local nvmedev
+	local loop_dev
+	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"
+	port="$(_create_nvmet_port "loop")"
+	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+
+	nvme connect -t loop -n "${subsys_name}"
+
+	nvmedev="$(_find_nvme_loop_dev)"
+	cat "/sys/block/${nvmedev}n1/uuid"
+	cat "/sys/block/${nvmedev}n1/wwid"
+
+	nvme smart-log "/dev/${nvmedev}" -n 1 > /dev/null 2>&1
+
+	rc=$?
+
+	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 -f "${file_path}"
+
+	modprobe -r nvme-loop
+	modprobe -r nvmet
+
+	if [ $rc -ne 0 ]; then
+		echo "Test Failed"
+	else
+		echo "Test complete"
+	fi
+}
tests/nvme/023.out new file +5 -0
new file mode 100644
index 0000000..aeb3ea7
@@ -0,0 +1,5 @@
+Running nvme/023
+91fdba0d-f87b-4c25-b80f-db7be1418b9e
+uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Test complete
Signature · 1 line
2.17.0
#8 lore raw

PATCH v2 6/12 nvme: add NVMeOF smart-log test for file-ns

In reply to Chaitanya Kulkarni
Signed-off-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 tests/nvme/024     | 77 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/024.out |  5 +++
 2 files changed, 82 insertions(+)
 create mode 100755 tests/nvme/024
 create mode 100644 tests/nvme/024.out
tests/nvme/024 new file +77 -0
new file mode 100755
index 0000000..49a4eb9
@@ -0,0 +1,77 @@
+#!/bin/bash
+# Test NVMe smart-log command on NVMeOF with a file-backed ns.
+# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.
+#
+#   Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+
+. tests/nvme/rc
+
+DESCRIPTION="test NVMe smart-log command on NVMeOF file-backed ns"
+QUICK=1
+
+requires() {
+	_have_program nvme && _have_module nvme-loop && _have_module loop && \
+		_have_module nvmet && _have_configfs
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	modprobe nvmet
+	modprobe nvme-loop
+
+	local port
+	local nvmedev
+	local file_path="$TMPDIR/img"
+	local subsys_name="blktests-subsystem-1"
+
+	truncate -s 1G "${file_path}"
+
+	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
+		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
+	port="$(_create_nvmet_port "loop")"
+	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+
+	nvme connect -t loop -n "${subsys_name}"
+
+	nvmedev="$(_find_nvme_loop_dev)"
+	cat "/sys/block/${nvmedev}n1/uuid"
+	cat "/sys/block/${nvmedev}n1/wwid"
+
+	nvme smart-log "/dev/${nvmedev}" -n 1 > /dev/null 2>&1
+
+	rc=$?
+
+	nvme disconnect -n "${subsys_name}"
+
+	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
+	_remove_nvmet_subsystem "${subsys_name}"
+	_remove_nvmet_port "${port}"
+
+	rm -f "${file_path}"
+
+	modprobe -r nvme-loop
+	modprobe -r nvmet
+
+	if [ $rc -ne 0 ]; then
+		echo "Test Failed"
+	else
+		echo "Test complete"
+	fi
+}
tests/nvme/024.out new file +5 -0
new file mode 100644
index 0000000..737d22f
@@ -0,0 +1,5 @@
+Running nvme/024
+91fdba0d-f87b-4c25-b80f-db7be1418b9e
+uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Test complete
Signature · 1 line
2.17.0
#9 lore raw

PATCH v2 7/12 nvme: add NVMeOF effects-log test for file-ns

In reply to Chaitanya Kulkarni
Signed-off-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 tests/nvme/025     | 77 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/025.out |  5 +++
 2 files changed, 82 insertions(+)
 create mode 100755 tests/nvme/025
 create mode 100644 tests/nvme/025.out
tests/nvme/025 new file +77 -0
new file mode 100755
index 0000000..b12a5f5
@@ -0,0 +1,77 @@
+#!/bin/bash
+# Test NVMe effects-log command on NVMeOF with a file-backed ns.
+# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.
+#
+#   Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+
+. tests/nvme/rc
+
+DESCRIPTION="test NVMe effects-log command on NVMeOF file-backed ns"
+QUICK=1
+
+requires() {
+	_have_program nvme && _have_module nvme-loop && _have_module loop && \
+		_have_module nvmet && _have_configfs
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	modprobe nvmet
+	modprobe nvme-loop
+
+	local port
+	local nvmedev
+	local file_path="$TMPDIR/img"
+	local subsys_name="blktests-subsystem-1"
+
+	truncate -s 1G "${file_path}"
+
+	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
+		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
+	port="$(_create_nvmet_port "loop")"
+	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+
+	nvme connect -t loop -n "${subsys_name}"
+
+	nvmedev="$(_find_nvme_loop_dev)"
+	cat "/sys/block/${nvmedev}n1/uuid"
+	cat "/sys/block/${nvmedev}n1/wwid"
+
+	nvme effects-log "/dev/${nvmedev}" > /dev/null 2>&1
+
+	rc=$?
+
+	nvme disconnect -n "${subsys_name}"
+
+	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
+	_remove_nvmet_subsystem "${subsys_name}"
+	_remove_nvmet_port "${port}"
+
+	rm -f "${file_path}"
+
+	modprobe -r nvme-loop
+	modprobe -r nvmet
+
+	if [ $rc -ne 0 ]; then
+		echo "Test Failed"
+	else
+		echo "Test complete"
+	fi
+}
tests/nvme/025.out new file +5 -0
new file mode 100644
index 0000000..b700bc7
@@ -0,0 +1,5 @@
+Running nvme/025
+91fdba0d-f87b-4c25-b80f-db7be1418b9e
+uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Test complete
Signature · 1 line
2.17.0
#10 lore raw

PATCH v2 8/12 nvme: add NVMeOF ns-desc test for file-ns

In reply to Chaitanya Kulkarni
Signed-off-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 tests/nvme/026     | 77 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/026.out |  5 +++
 2 files changed, 82 insertions(+)
 create mode 100755 tests/nvme/026
 create mode 100644 tests/nvme/026.out
tests/nvme/026 new file +77 -0
new file mode 100755
index 0000000..38ef38a
@@ -0,0 +1,77 @@
+#!/bin/bash
+# Test NVMe ns-descs command on NVMeOF with a file-backed ns.
+# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.
+#
+#   Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+
+. tests/nvme/rc
+
+DESCRIPTION="test NVMe ns-descs command on NVMeOF file-backed ns"
+QUICK=1
+
+requires() {
+	_have_program nvme && _have_module nvme-loop && _have_module loop && \
+		_have_module nvmet && _have_configfs
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	modprobe nvmet
+	modprobe nvme-loop
+
+	local port
+	local nvmedev
+	local file_path="$TMPDIR/img"
+	local subsys_name="blktests-subsystem-1"
+
+	truncate -s 1G "${file_path}"
+
+	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
+		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
+	port="$(_create_nvmet_port "loop")"
+	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+
+	nvme connect -t loop -n "${subsys_name}"
+
+	nvmedev="$(_find_nvme_loop_dev)"
+	cat "/sys/block/${nvmedev}n1/uuid"
+	cat "/sys/block/${nvmedev}n1/wwid"
+
+	nvme ns-descs "/dev/${nvmedev}" -n 1 > /dev/null 2>&1
+
+	rc=$?
+
+	nvme disconnect -n "${subsys_name}"
+
+	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
+	_remove_nvmet_subsystem "${subsys_name}"
+	_remove_nvmet_port "${port}"
+
+	rm -f "${file_path}"
+
+	modprobe -r nvme-loop
+	modprobe -r nvmet
+
+	if [ $rc -ne 0 ]; then
+		echo "Test Failed"
+	else
+		echo "Test complete"
+	fi
+}
tests/nvme/026.out new file +5 -0
new file mode 100644
index 0000000..dcee481
@@ -0,0 +1,5 @@
+Running nvme/026
+91fdba0d-f87b-4c25-b80f-db7be1418b9e
+uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Test complete
Signature · 1 line
2.17.0
#11 lore raw

PATCH v2 9/12 nvme: add NVMeOF ns-rescan test for file-ns

In reply to Chaitanya Kulkarni
Signed-off-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 tests/nvme/027     | 77 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/027.out |  5 +++
 2 files changed, 82 insertions(+)
 create mode 100755 tests/nvme/027
 create mode 100644 tests/nvme/027.out
tests/nvme/027 new file +77 -0
new file mode 100755
index 0000000..8711f48
@@ -0,0 +1,77 @@
+#!/bin/bash
+# Test NVMe ns-rescan command on NVMeOF with a file-backed ns.
+# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.
+#
+#   Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+
+. tests/nvme/rc
+
+DESCRIPTION="test NVMe ns-rescan command on NVMeOF file-backed ns"
+QUICK=1
+
+requires() {
+	_have_program nvme && _have_module nvme-loop && _have_module loop && \
+		_have_module nvmet && _have_configfs
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	modprobe nvmet
+	modprobe nvme-loop
+
+	local port
+	local nvmedev
+	local file_path="$TMPDIR/img"
+	local subsys_name="blktests-subsystem-1"
+
+	truncate -s 1G "${file_path}"
+
+	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
+		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
+	port="$(_create_nvmet_port "loop")"
+	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+
+	nvme connect -t loop -n "${subsys_name}"
+
+	nvmedev="$(_find_nvme_loop_dev)"
+	cat "/sys/block/${nvmedev}n1/uuid"
+	cat "/sys/block/${nvmedev}n1/wwid"
+
+	nvme ns-rescan "/dev/${nvmedev}" > /dev/null 2>&1
+
+	rc=$?
+
+	nvme disconnect -n "${subsys_name}"
+
+	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
+	_remove_nvmet_subsystem "${subsys_name}"
+	_remove_nvmet_port "${port}"
+
+	rm -f "${file_path}"
+
+	modprobe -r nvme-loop
+	modprobe -r nvmet
+
+	if [ $rc -ne 0 ]; then
+		echo "Test Failed"
+	else
+		echo "Test complete"
+	fi
+}
tests/nvme/027.out new file +5 -0
new file mode 100644
index 0000000..f114fcd
@@ -0,0 +1,5 @@
+Running nvme/027
+91fdba0d-f87b-4c25-b80f-db7be1418b9e
+uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Test complete
Signature · 1 line
2.17.0
#12 lore raw

PATCH v2 10/12 nvme: add NVMeOF list-subsys test for file-ns

In reply to Chaitanya Kulkarni
Signed-off-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 tests/nvme/028     | 77 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/028.out |  5 +++
 2 files changed, 82 insertions(+)
 create mode 100755 tests/nvme/028
 create mode 100644 tests/nvme/028.out
tests/nvme/028 new file +77 -0
new file mode 100755
index 0000000..5b46794
@@ -0,0 +1,77 @@
+#!/bin/bash
+# Test NVMe list-subsys command on NVMeOF with a file-backed ns.
+# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.
+#
+#   Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+
+. tests/nvme/rc
+
+DESCRIPTION="test NVMe list-subsys command on NVMeOF file-backed ns"
+QUICK=1
+
+requires() {
+	_have_program nvme && _have_module nvme-loop && _have_module loop && \
+		_have_module nvmet && _have_configfs
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	modprobe nvmet
+	modprobe nvme-loop
+
+	local port
+	local nvmedev
+	local file_path="$TMPDIR/img"
+	local subsys_name="blktests-subsystem-1"
+
+	truncate -s 1G "${file_path}"
+
+	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
+		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
+	port="$(_create_nvmet_port "loop")"
+	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+
+	nvme connect -t loop -n "${subsys_name}"
+
+	nvmedev="$(_find_nvme_loop_dev)"
+	cat "/sys/block/${nvmedev}n1/uuid"
+	cat "/sys/block/${nvmedev}n1/wwid"
+
+	nvme list-subsys | grep -q loop
+
+	rc=$?
+
+	nvme disconnect -n "${subsys_name}"
+
+	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
+	_remove_nvmet_subsystem "${subsys_name}"
+	_remove_nvmet_port "${port}"
+
+	rm -f "${file_path}"
+
+	modprobe -r nvme-loop
+	modprobe -r nvmet
+
+	if [ $rc -ne 0 ]; then
+		echo "Test Failed"
+	else
+		echo "Test complete"
+	fi
+}
tests/nvme/028.out new file +5 -0
new file mode 100644
index 0000000..c92b82d
@@ -0,0 +1,5 @@
+Running nvme/028
+91fdba0d-f87b-4c25-b80f-db7be1418b9e
+uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Test complete
Signature · 1 line
2.17.0
#13 lore raw

PATCH v2 11/12 nvme: add NVMeOF list test for file-ns

In reply to Chaitanya Kulkarni
Signed-off-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 tests/nvme/029     | 77 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/029.out |  5 +++
 2 files changed, 82 insertions(+)
 create mode 100755 tests/nvme/029
 create mode 100644 tests/nvme/029.out
tests/nvme/029 new file +77 -0
new file mode 100755
index 0000000..9375c3d
@@ -0,0 +1,77 @@
+#!/bin/bash
+# Test NVMe list command on NVMeOF with a file-backed ns.
+# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.
+#
+#   Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+
+. tests/nvme/rc
+
+DESCRIPTION="test NVMe list command on NVMeOF file-backed ns"
+QUICK=1
+
+requires() {
+	_have_program nvme && _have_module nvme-loop && _have_module loop && \
+		_have_module nvmet && _have_configfs
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	modprobe nvmet
+	modprobe nvme-loop
+
+	local port
+	local nvmedev
+	local file_path="$TMPDIR/img"
+	local subsys_name="blktests-subsystem-1"
+
+	truncate -s 1G "${file_path}"
+
+	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
+		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
+	port="$(_create_nvmet_port "loop")"
+	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+
+	nvme connect -t loop -n "${subsys_name}"
+
+	nvmedev="$(_find_nvme_loop_dev)"
+	cat "/sys/block/${nvmedev}n1/uuid"
+	cat "/sys/block/${nvmedev}n1/wwid"
+
+	nvme list > /dev/null 2>&1
+
+	rc=$?
+
+	nvme disconnect -n "${subsys_name}"
+
+	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
+	_remove_nvmet_subsystem "${subsys_name}"
+	_remove_nvmet_port "${port}"
+
+	rm -f "${file_path}"
+
+	modprobe -r nvme-loop
+	modprobe -r nvmet
+
+	if [ $rc -ne 0 ]; then
+		echo "Test Failed"
+	else
+		echo "Test complete"
+	fi
+}
tests/nvme/029.out new file +5 -0
new file mode 100644
index 0000000..98d7dec
@@ -0,0 +1,5 @@
+Running nvme/029
+91fdba0d-f87b-4c25-b80f-db7be1418b9e
+uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Test complete
Signature · 1 line
2.17.0
#14 lore raw

PATCH v2 12/12 nvme: add NVMeOF reset test for file-ns

In reply to Chaitanya Kulkarni
Signed-off-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 tests/nvme/030     | 77 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/030.out |  5 +++
 2 files changed, 82 insertions(+)
 create mode 100755 tests/nvme/030
 create mode 100644 tests/nvme/030.out
tests/nvme/030 new file +77 -0
new file mode 100755
index 0000000..a723aa9
@@ -0,0 +1,77 @@
+#!/bin/bash
+# Test NVMe reset command on NVMeOF with a file-backed ns.
+# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.
+#
+#   Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+
+. tests/nvme/rc
+
+DESCRIPTION="test NVMe reset command on NVMeOF file-backed ns"
+QUICK=1
+
+requires() {
+	_have_program nvme && _have_module nvme-loop && _have_module loop && \
+		_have_module nvmet && _have_configfs
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	modprobe nvmet
+	modprobe nvme-loop
+
+	local port
+	local nvmedev
+	local file_path="$TMPDIR/img"
+	local subsys_name="blktests-subsystem-1"
+
+	truncate -s 1G "${file_path}"
+
+	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
+		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
+	port="$(_create_nvmet_port "loop")"
+	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+
+	nvme connect -t loop -n "${subsys_name}"
+
+	nvmedev="$(_find_nvme_loop_dev)"
+	cat "/sys/block/${nvmedev}n1/uuid"
+	cat "/sys/block/${nvmedev}n1/wwid"
+
+	nvme reset "/dev/${nvmedev}" > /dev/null 2>&1
+
+	rc=$?
+
+	nvme disconnect -n "${subsys_name}"
+
+	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
+	_remove_nvmet_subsystem "${subsys_name}"
+	_remove_nvmet_port "${port}"
+
+	rm -f "${file_path}"
+
+	modprobe -r nvme-loop
+	modprobe -r nvmet
+
+	if [ $rc -ne 0 ]; then
+		echo "Test Failed"
+	else
+		echo "Test complete"
+	fi
+}
tests/nvme/030.out new file +5 -0
new file mode 100644
index 0000000..0fc1b3d
@@ -0,0 +1,5 @@
+Running nvme/030
+91fdba0d-f87b-4c25-b80f-db7be1418b9e
+uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Test complete
Signature · 1 line
2.17.0