]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
blktests: add NVMeOF many bdev-ns creation test
authorChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Mon, 11 Jun 2018 09:15:53 +0000 (05:15 -0400)
committerOmar Sandoval <osandov@fb.com>
Thu, 26 Jul 2018 21:28:25 +0000 (14:28 -0700)
This patch adds a new testcase to exercise a large number of ns
creation and deletion along with discovery command.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
tests/nvme/016 [new file with mode: 0755]
tests/nvme/016.out [new file with mode: 0644]

diff --git a/tests/nvme/016 b/tests/nvme/016
new file mode 100755 (executable)
index 0000000..82baf9f
--- /dev/null
@@ -0,0 +1,66 @@
+#!/bin/bash
+# Test many target bdev-ns creation/deletion under one subsystem.
+# 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@wdc.com>
+#
+
+. tests/nvme/rc
+
+DESCRIPTION="create/delete many NVMeOF block device-backed ns and test discovery"
+
+requires() {
+       _have_program nvme && _have_module nvme-loop && _have_module nvmet \
+               _have_configfs
+}
+
+test() {
+       echo "Running ${TEST_NAME}"
+
+       local port
+       local iterations=1000
+       local loop_dev
+       local subsys_nqn="blktests-subsystem-1"
+
+       modprobe nvmet
+       modprobe nvme-loop
+
+       loop_dev="$(losetup -f)"
+
+       _create_nvmet_subsystem "${subsys_nqn}" "${loop_dev}"
+
+       for ((i = 2; i <= iterations; i++)); do
+               _create_nvmet_ns "${subsys_nqn}" "${i}" "${loop_dev}"
+       done
+
+       port="$(_create_nvmet_port "loop")"
+       _add_nvmet_subsys_to_port "$port" "${subsys_nqn}"
+
+       nvme discover -t loop | sed -r -e "s/portid:  [0-9]+/portid:  X/"
+       _remove_nvmet_subsystem_from_port "${port}" "${subsys_nqn}"
+       _remove_nvmet_port "${port}"
+
+       for ((i = iterations; i > 1; i--)); do
+               _remove_nvmet_ns "${subsys_nqn}" $i
+       done
+
+       _remove_nvmet_subsystem "${subsys_nqn}"
+
+       modprobe -r nvme-loop nvmet
+       echo "Test complete"
+}
diff --git a/tests/nvme/016.out b/tests/nvme/016.out
new file mode 100644 (file)
index 0000000..59bd293
--- /dev/null
@@ -0,0 +1,13 @@
+Running nvme/016
+
+Discovery Log Number of Records 1, Generation counter 1
+=====Discovery Log Entry 0======
+trtype:  loop
+adrfam:  pci
+subtype: nvme subsystem
+treq:    not specified
+portid:  X
+trsvcid: 
+subnqn:  blktests-subsystem-1
+traddr:  
+Test complete