From: osandov@osandov.com (Omar Sandoval)
Subject: [PATCH blktests 1/3] nvme: move _find_nvme_loop_dev to common code
Date: Mon, 14 May 2018 13:02:52 -0700 [thread overview]
Message-ID: <20180514200252.GA13417@vader> (raw)
In-Reply-To: <20180503150054.14022-1-jthumshirn@suse.de>
On Thu, May 03, 2018@05:00:52PM +0200, Johannes Thumshirn wrote:
> _find_nvme_loop_dev is quite useful for all nvme test, so move it over
> to common code.
>
> Signed-off-by: Johannes Thumshirn <jthumshirn at suse.de>
> ---
> common/nvme | 10 ++++++++++
> tests/nvme/004 | 14 ++------------
> 2 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/common/nvme b/common/nvme
> index c6718f04811b..c4a44065cd9f 100644
> --- a/common/nvme
> +++ b/common/nvme
> @@ -93,3 +93,13 @@ _remove_nvmet_subsystem_from_port() {
>
> rm "${nvmet_cfs}/ports/${port}/subsystems/${nvmet_subsystem}"
> }
> +
> +_find_nvme_loop_dev() {
> + for dev in /sys/class/nvme/nvme*; do
> + dev="$(basename "$dev")"
> + transport="$(cat "/sys/class/nvme/${dev}/transport")"
> + if [[ "$transport" == "loop" ]]; then
> + echo "$dev"
> + fi
> + done
> +}
> diff --git a/tests/nvme/004 b/tests/nvme/004
> index 65bcd40d86d1..2f970b366d41 100755
> --- a/tests/nvme/004
> +++ b/tests/nvme/004
> @@ -27,16 +27,6 @@ requires() {
> _have_configfs
> }
>
> -_find_nvme_loop_dev() {
> - for dev in /sys/block/nvme*; do
> - dev="$(basename "$dev")"
> - transport="$(cat "/sys/block/${dev}/device/transport")"
> - if [[ "$transport" == "loop" ]]; then
> - echo "$dev"
> - fi
> - done
> -}
> -
> test() {
> echo "Running ${TEST_NAME}"
>
> @@ -59,8 +49,8 @@ test() {
>
> local nvmedev
> nvmedev="$(_find_nvme_loop_dev)"
> - cat "/sys/block/${nvmedev}/uuid"
> - cat "/sys/block/${nvmedev}/wwid"
> + cat "/sys/block/${nvmedev}n1/uuid"
> + cat "/sys/block/${nvmedev}n1/wwid"
>
> _remove_nvmet_subsystem_from_port "${port}" "blktests-subsystem-1"
> _remove_nvmet_subsystem "blktests-subsystem-1"
> --
> 2.16.3
>
Thanks, Johannes, applied. I split patch 1 into two, though; one fixing
the test, and one just moving the function.
next prev parent reply other threads:[~2018-05-14 20:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-03 15:00 [PATCH blktests 1/3] nvme: move _find_nvme_loop_dev to common code Johannes Thumshirn
2018-05-03 15:00 ` [PATCH blktests 2/3] nvme: fix counting the target port Johannes Thumshirn
2018-05-03 15:00 ` [PATCH blktests 3/3] nvme: add test for resetting the loopback controller Johannes Thumshirn
2018-05-03 19:03 ` chaitany kulkarni
2018-05-04 7:34 ` Johannes Thumshirn
2018-05-14 20:02 ` Omar Sandoval [this message]
2018-05-15 6:50 ` [PATCH blktests 1/3] nvme: move _find_nvme_loop_dev to common code 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=20180514200252.GA13417@vader \
--to=osandov@osandov.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox