]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
test/nvme/003: add test case for patch "nvme: don't send keep-alives to the discovery...
authorJohannes Thumshirn <jthumshirn@suse.de>
Tue, 27 Mar 2018 09:21:09 +0000 (11:21 +0200)
committerOmar Sandoval <osandov@fb.com>
Sat, 7 Apr 2018 04:00:57 +0000 (21:00 -0700)
Add a regression test for the patch titled "nvme: don't send
keep-alives to the discovery controller".

This patch creates a local loopback nvme target and then connects to
it. If the patch is not applied we see two error messages in dmesg:
"failed nvme_keep_alive_end_io error=" from the nvme host and "nvmet:
unsupported cmd 24" from the nvme target. If the patch is applied
dmesg is quiet.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
tests/nvme/003 [new file with mode: 0755]
tests/nvme/003.out [new file with mode: 0644]

diff --git a/tests/nvme/003 b/tests/nvme/003
new file mode 100755 (executable)
index 0000000..919a131
--- /dev/null
@@ -0,0 +1,63 @@
+#!/bin/bash
+#
+# Regression test for patch "nvme: don't send keep-alives to the discovery
+# controller"
+#
+# Copyright (C) 2018 Johannes Thumshirn
+#
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+DESCRIPTION="test if we're sending keep-alives to a discovery controller"
+
+QUICK=1
+
+requires() {
+       _have_program nvme && _have_module nvme-loop && _have_module loop \
+               && _have_configfs
+}
+
+test() {
+       echo "Running ${TEST_NAME}"
+
+       modprobe nvmet
+       modprobe nvme-loop
+
+       local port
+       port="$(_create_nvmet_port "loop")"
+
+       local loop_dev
+       loop_dev="$(losetup -f)"
+
+       _create_nvmet_subsystem "blktests-subsystem-1" "${loop_dev}"
+       _add_nvmet_subsys_to_port "${port}" "blktests-subsystem-1"
+
+       nvme connect -t loop -n nqn.2014-08.org.nvmexpress.discovery
+
+       # This is ugly but checking for the absence of error messages is ...
+       sleep 10
+
+       if dmesg | grep -q "failed nvme_keep_alive_end_io error="; then
+               echo "Fail"
+       fi
+
+       if dmesg | grep -q "nvmet: unsupported cmd 24"; then
+               echo "Fail"
+       fi
+
+       _remove_nvmet_subsystem_from_port "${port}" "blktests-subsystem-1"
+       _remove_nvmet_subsystem "blktests-subsystem-1"
+       _remove_nvmet_port "${port}"
+
+       echo "Test complete"
+}
diff --git a/tests/nvme/003.out b/tests/nvme/003.out
new file mode 100644 (file)
index 0000000..01b2756
--- /dev/null
@@ -0,0 +1,2 @@
+Running nvme/003
+Test complete