linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Cc: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org
Subject: Re: [PATCH 2/5 blktests] nvme: test target cntlid min cntlid max
Date: Tue, 11 Feb 2020 13:58:12 -0800	[thread overview]
Message-ID: <20200211215812.GC100751@vader> (raw)
In-Reply-To: <20200129232921.11771-3-chaitanya.kulkarni@wdc.com>

On Wed, Jan 29, 2020 at 03:29:18PM -0800, Chaitanya Kulkarni wrote:
> The new testcases exercises newly added cntlid [min|max] attributes
> for NVMeOF target.
> 
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> ---
>  tests/nvme/033     | 57 ++++++++++++++++++++++++++++++++++++++++++++++
>  tests/nvme/033.out |  4 ++++
>  2 files changed, 61 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..97eba7f
> --- /dev/null
> +++ b/tests/nvme/033
> @@ -0,0 +1,57 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0+
> +# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates.
> +#
> +# Test NVMeOF target cntlid[min|max] attributes.
> +
> +. tests/nvme/rc
> +
> +DESCRIPTION="Test NVMeOF target cntlid[min|max] attributes"
> +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 cid_min=14
> +	local cid_max=15
> +	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" ${cid_min} ${cid_max}
> +	port="$(_create_nvmet_port "loop")"
> +	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
> +
> +	nvme connect -t loop -n "${subsys_name}"
> +
> +	udevadm settle
> +
> +	nvmedev="$(_find_nvme_loop_dev)"
> +	nvme id-ctrl /dev/${nvmedev}n1 | grep cntlid | tr -s ' ' ' '
> +
> +	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"
> +}

Another shellcheck warning:

tests/nvme/033:44:20: note: Double quote to prevent globbing and word splitting. [SC2086]

Also, this fails on kernels without this feature:

nvme/033 (Test NVMeOF target cntlid[min|max] attributes)     [failed]
    runtime    ...  2.262s
    --- tests/nvme/033.out      2020-02-11 13:52:20.346831467 -0800
    +++ /home/vmuser/repos/blktests/results/nodev/nvme/033.out.bad      2020-02-11 13:52:42.006948791 -0800
    @@ -1,4 +1,4 @@
     Running nvme/033
    -cntlid : e
    +cntlid : 0x1
     NQN:blktests-subsystem-1 disconnected 1 controller(s)
     Test complete

Presumably because _create_nvmet_subsystem silently does nothing if
attr_cntlid_min doesn't exist. We should skip the test if the kernel doesn't
support it rather than ignoring it in _create_nvmet_subsystem.

  reply	other threads:[~2020-02-11 21:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-29 23:29 [PATCH 0/5 blktest] nvme: add cntlid and model testcases Chaitanya Kulkarni
2020-01-29 23:29 ` [PATCH 1/5 blktests] nvme: allow target subsys set cntlid min/max Chaitanya Kulkarni
2020-02-11 21:50   ` Omar Sandoval
2020-01-29 23:29 ` [PATCH 2/5 blktests] nvme: test target cntlid min cntlid max Chaitanya Kulkarni
2020-02-11 21:58   ` Omar Sandoval [this message]
2020-01-29 23:29 ` [PATCH 3/5 blktests] nvme: allow target subsys set model Chaitanya Kulkarni
2020-02-11 22:00   ` Omar Sandoval
2020-02-14  0:58     ` Chaitanya Kulkarni
2020-02-14  1:11     ` Chaitanya Kulkarni
2020-01-29 23:29 ` [PATCH 4/5 blktests] nvme: test target model attribute Chaitanya Kulkarni
2020-02-11 22:04   ` Omar Sandoval
2020-01-29 23:29 ` [PATCH 5/5 blktests] nvme: make new testcases backward compatible Chaitanya Kulkarni
2020-02-11 22:06   ` Omar Sandoval
2020-02-11 22:18     ` Chaitanya Kulkarni
2020-02-03 22:48 ` [PATCH 0/5 blktest] nvme: add cntlid and model testcases Chaitanya Kulkarni
2020-02-11 16:46   ` Chaitanya Kulkarni
2020-02-11 22:07     ` Omar Sandoval
2020-02-11 22:17       ` Chaitanya Kulkarni

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=20200211215812.GC100751@vader \
    --to=osandov@osandov.com \
    --cc=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).