All of lore.kernel.org
 help / color / mirror / Atom feed
From: chaitanya.kulkarni@wdc.com (Chaitanya Kulkarni)
Subject: [PATCH 11/12] blktests: add NVMeOF flush test for bdev-ns
Date: Tue,  5 Jun 2018 20:52:09 -0400	[thread overview]
Message-ID: <20180606005210.4197-12-chaitanya.kulkarni@wdc.com> (raw)
In-Reply-To: <20180606005210.4197-1-chaitanya.kulkarni@wdc.com>

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 tests/nvme/015     | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/015.out |  6 +++++
 2 files changed, 79 insertions(+)
 create mode 100755 tests/nvme/015
 create mode 100755 tests/nvme/015.out

diff --git a/tests/nvme/015 b/tests/nvme/015
new file mode 100755
index 0000000..5af2950
--- /dev/null
+++ b/tests/nvme/015
@@ -0,0 +1,73 @@
+#!/bin/bash
+# Test NVMeOF flush command from host with a block device 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>
+#
+
+DESCRIPTION="unit test for NVMe flush for block device backed ns"
+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
+	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"
+
+	dd=/dev/urandom of="/dev/${nvmedev}n1" count=128000 bs=4k
+
+	nvme flush /dev/"${nvmedev}n1"
+
+	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/015.out b/tests/nvme/015.out
new file mode 100755
index 0000000..23763f1
--- /dev/null
+++ b/tests/nvme/015.out
@@ -0,0 +1,6 @@
+Running nvme/015
+91fdba0d-f87b-4c25-b80f-db7be1418b9e
+uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
+NVMe Flush: success
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Test complete
-- 
2.9.5

  parent reply	other threads:[~2018-06-06  0:52 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-06  0:51 [PATCH 00/10] blktests: NVMeOF new testcases for file and bdev ns Chaitanya Kulkarni
2018-06-06  0:51 ` [PATCH 01/12] blktests: common/nvme export ns-mgmt interfaces Chaitanya Kulkarni
2018-06-06  7:20   ` Johannes Thumshirn
2018-06-06  0:52 ` [PATCH 02/12] blktests: add NVMeOF many bdev-ns creation test Chaitanya Kulkarni
2018-06-06  7:27   ` Johannes Thumshirn
2018-06-06  0:52 ` [PATCH 03/12] blktests: add NVMeOF bdev-ns target " Chaitanya Kulkarni
2018-06-06  7:30   ` Johannes Thumshirn
     [not found]     ` <DM5PR04MB12131353AC241CAB01D90AC686650@DM5PR04MB1213.namprd04.prod.outlook.com>
2018-06-07  6:58       ` Johannes Thumshirn
2018-06-06  0:52 ` [PATCH 04/12] blktests: add NVMeOF file-ns " Chaitanya Kulkarni
2018-06-06  7:31   ` Johannes Thumshirn
2018-06-06  0:52 ` [PATCH 05/12] blktests: add NVMeOF bdev-ns host creation Chaitanya Kulkarni
2018-06-06  7:33   ` Johannes Thumshirn
2018-06-06  0:52 ` [PATCH 06/12] blktests: add NVMeOF file-ns " Chaitanya Kulkarni
2018-06-06  7:35   ` Johannes Thumshirn
2018-06-06  0:52 ` [PATCH 07/12] blktests: add NVMeoF data verification test for bdev-ns Chaitanya Kulkarni
2018-06-06  7:41   ` Johannes Thumshirn
     [not found]     ` <DM5PR04MB12138A3A89F921B64F6D2C5686650@DM5PR04MB1213.namprd04.prod.outlook.com>
2018-06-07  7:00       ` Johannes Thumshirn
     [not found]         ` <BN6PR04MB12032A2B64CD4F46E0A5C6CB867B0@BN6PR04MB1203.namprd04.prod.outlook.com>
2018-06-09 13:51           ` Johannes Thumshirn
2018-06-09 15:37             ` Chaitanya Kulkarni
2018-06-06  0:52 ` [PATCH 08/12] blktests: add NVMeOF data verification test for file-ns Chaitanya Kulkarni
2018-06-06  7:44   ` Johannes Thumshirn
2018-06-06  0:52 ` [PATCH 09/12] blktests: add NVMeOF mkfs test for bdev-ns Chaitanya Kulkarni
2018-06-06  7:47   ` Johannes Thumshirn
2018-06-06  0:52 ` [PATCH 10/12] blktests: add NVMeOF mkfs test for file-ns Chaitanya Kulkarni
2018-06-06  7:49   ` Johannes Thumshirn
2018-06-06  0:52 ` Chaitanya Kulkarni [this message]
2018-06-06  7:56   ` [PATCH 11/12] blktests: add NVMeOF flush test for bdev-ns Johannes Thumshirn
2018-06-06  0:52 ` [PATCH 12/12] blktests: add NVMeOF flush test for file-ns Chaitanya Kulkarni
2018-06-06  7:57   ` Johannes Thumshirn
2018-06-06  7:14 ` [PATCH 00/10] blktests: NVMeOF new testcases for file and bdev ns Johannes Thumshirn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180606005210.4197-12-chaitanya.kulkarni@wdc.com \
    --to=chaitanya.kulkarni@wdc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.