From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org
Cc: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Subject: [blktests PATCH 2/2] nvme: add new test to check model attribute
Date: Wed, 30 Oct 2019 12:52:58 -0700 [thread overview]
Message-ID: <20191030195258.31108-3-chaitanya.kulkarni@wdc.com> (raw)
In-Reply-To: <20191030195258.31108-1-chaitanya.kulkarni@wdc.com>
This test allows us to dynamically set the subsys model attribute
and verify in the nvme list command output.
---
tests/nvme/033 | 61 ++++++++++++++++++++++++++++++++++++++++++++++
tests/nvme/033.out | 3 +++
2 files changed, 64 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..8ddadcf
--- /dev/null
+++ b/tests/nvme/033
@@ -0,0 +1,61 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates.
+#
+# Test NVMeOF model attribute for subsys.
+
+. tests/nvme/rc
+
+DESCRIPTION="test added subsys 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 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" "${subsys_name}"
+ port="$(_create_nvmet_port "loop")"
+ _add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+
+ nvme connect -t loop -n "${subsys_name}"
+
+ nvme list | grep -v grep | grep -q "${subsys_name}"
+ ret=$?
+
+ nvmedev="$(_find_nvme_loop_dev)"
+
+ udevadm settle
+
+ 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 [ ${ret} == 1 ]; then
+ echo "Test Fail"
+ else
+ echo "Test complete"
+ fi
+}
diff --git a/tests/nvme/033.out b/tests/nvme/033.out
new file mode 100644
index 0000000..eb508be
--- /dev/null
+++ b/tests/nvme/033.out
@@ -0,0 +1,3 @@
+Running nvme/033
+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
prev parent reply other threads:[~2019-10-30 19:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-30 19:52 [blktests PATCH 0/2] nvme: add a new test to check model attr Chaitanya Kulkarni
2019-10-30 19:52 ` [blktests PATCH 1/2] nvme: handle model attr in subsys create helper Chaitanya Kulkarni
2019-11-01 7:42 ` Chaitanya Kulkarni
2019-10-30 19:52 ` Chaitanya Kulkarni [this message]
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=20191030195258.31108-3-chaitanya.kulkarni@wdc.com \
--to=chaitanya.kulkarni@wdc.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).