From: Logan Gunthorpe <logang@deltatee.com> To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, Omar Sandoval <osandov@fb.com> Cc: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>, Michael Moese <mmoese@suse.de>, Theodore Ts'o <tytso@mit.edu>, Johannes Thumshirn <jthumshirn@suse.de>, Stephen Bates <sbates@raithlin.com>, Logan Gunthorpe <logang@deltatee.com> Subject: [PATCH blktests v2 03/12] nvme: Add new test to verify the generation counter Date: Wed, 17 Jul 2019 11:12:50 -0600 [thread overview] Message-ID: <20190717171259.3311-4-logang@deltatee.com> (raw) In-Reply-To: <20190717171259.3311-1-logang@deltatee.com> Now that the other discovery tests ignore the generation counter value, create a new test to specifically check that it increments when subsystems are added or removed from ports and when allow_any_host is set/unset. Signed-off-by: Logan Gunthorpe <logang@deltatee.com> --- tests/nvme/030 | 76 ++++++++++++++++++++++++++++++++++++++++++++++ tests/nvme/030.out | 2 ++ tests/nvme/rc | 5 +++ 3 files changed, 83 insertions(+) create mode 100755 tests/nvme/030 create mode 100644 tests/nvme/030.out diff --git a/tests/nvme/030 b/tests/nvme/030 new file mode 100755 index 000000000000..963e1ad7118c --- /dev/null +++ b/tests/nvme/030 @@ -0,0 +1,76 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Logan Gunthorpe +# +# Test nvme discovery generation counter + +. tests/nvme/rc + +DESCRIPTION="ensure the discovery generation counter is updated appropriately" +QUICK=1 + +requires() { + _have_program nvme && + _have_modules loop nvme-loop nvmet && + _have_configfs +} + + +checkgenctr() { + local last=$1 + local msg=$2 + local genctr + + genctr=$(_discovery_genctr) + if (( "${genctr}" <= "${last}" )); then + echo "Generation counter not incremented when ${msg} (${genctr} <= ${last})" + fi + + echo "${genctr}" +} + +test() { + local port + local genctr + local subsys="blktests-subsystem-" + + echo "Running ${TEST_NAME}" + + modprobe nvmet + modprobe nvme-loop + + port="$(_create_nvmet_port "loop")" + + _create_nvmet_subsystem "${subsys}1" "$(losetup -f)" + _add_nvmet_subsys_to_port "${port}" "${subsys}1" + + genctr=$(_discovery_genctr) + + _create_nvmet_subsystem "${subsys}2" "$(losetup -f)" + _add_nvmet_subsys_to_port "${port}" "${subsys}2" + + genctr=$(checkgenctr "${genctr}" "adding a subsystem to a port") + + echo 0 > "${NVMET_CFS}/subsystems/${subsys}2/attr_allow_any_host" + + genctr=$(checkgenctr "${genctr}" "clearing attr_allow_any_host") + + echo 1 > "${NVMET_CFS}/subsystems/${subsys}2/attr_allow_any_host" + + genctr=$(checkgenctr "${genctr}" "setting attr_allow_any_host") + + _remove_nvmet_subsystem_from_port "${port}" "${subsys}2" + _remove_nvmet_subsystem "${subsys}2" + + genctr=$(checkgenctr "${genctr}" "removing a subsystem from a port") + + _remove_nvmet_subsystem_from_port "${port}" "${subsys}1" + _remove_nvmet_subsystem "${subsys}1" + + _remove_nvmet_port "${port}" + + modprobe -r nvme-loop + modprobe -r nvmet + + echo "Test complete" +} diff --git a/tests/nvme/030.out b/tests/nvme/030.out new file mode 100644 index 000000000000..93e51905b5d4 --- /dev/null +++ b/tests/nvme/030.out @@ -0,0 +1,2 @@ +Running nvme/030 +Test complete diff --git a/tests/nvme/rc b/tests/nvme/rc index 74e316248ef5..7be6c903611b 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -124,3 +124,8 @@ _filter_discovery() { -e '/Discovery Log Number|Log Entry|trtype|subnqn/p' } + +_discovery_genctr() { + nvme discover -t loop | + sed -n -e 's/^.*Generation counter \([0-9]\+\).*$/\1/p' +} -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: logang@deltatee.com (Logan Gunthorpe) Subject: [PATCH blktests v2 03/12] nvme: Add new test to verify the generation counter Date: Wed, 17 Jul 2019 11:12:50 -0600 [thread overview] Message-ID: <20190717171259.3311-4-logang@deltatee.com> (raw) In-Reply-To: <20190717171259.3311-1-logang@deltatee.com> Now that the other discovery tests ignore the generation counter value, create a new test to specifically check that it increments when subsystems are added or removed from ports and when allow_any_host is set/unset. Signed-off-by: Logan Gunthorpe <logang at deltatee.com> --- tests/nvme/030 | 76 ++++++++++++++++++++++++++++++++++++++++++++++ tests/nvme/030.out | 2 ++ tests/nvme/rc | 5 +++ 3 files changed, 83 insertions(+) create mode 100755 tests/nvme/030 create mode 100644 tests/nvme/030.out diff --git a/tests/nvme/030 b/tests/nvme/030 new file mode 100755 index 000000000000..963e1ad7118c --- /dev/null +++ b/tests/nvme/030 @@ -0,0 +1,76 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Logan Gunthorpe +# +# Test nvme discovery generation counter + +. tests/nvme/rc + +DESCRIPTION="ensure the discovery generation counter is updated appropriately" +QUICK=1 + +requires() { + _have_program nvme && + _have_modules loop nvme-loop nvmet && + _have_configfs +} + + +checkgenctr() { + local last=$1 + local msg=$2 + local genctr + + genctr=$(_discovery_genctr) + if (( "${genctr}" <= "${last}" )); then + echo "Generation counter not incremented when ${msg} (${genctr} <= ${last})" + fi + + echo "${genctr}" +} + +test() { + local port + local genctr + local subsys="blktests-subsystem-" + + echo "Running ${TEST_NAME}" + + modprobe nvmet + modprobe nvme-loop + + port="$(_create_nvmet_port "loop")" + + _create_nvmet_subsystem "${subsys}1" "$(losetup -f)" + _add_nvmet_subsys_to_port "${port}" "${subsys}1" + + genctr=$(_discovery_genctr) + + _create_nvmet_subsystem "${subsys}2" "$(losetup -f)" + _add_nvmet_subsys_to_port "${port}" "${subsys}2" + + genctr=$(checkgenctr "${genctr}" "adding a subsystem to a port") + + echo 0 > "${NVMET_CFS}/subsystems/${subsys}2/attr_allow_any_host" + + genctr=$(checkgenctr "${genctr}" "clearing attr_allow_any_host") + + echo 1 > "${NVMET_CFS}/subsystems/${subsys}2/attr_allow_any_host" + + genctr=$(checkgenctr "${genctr}" "setting attr_allow_any_host") + + _remove_nvmet_subsystem_from_port "${port}" "${subsys}2" + _remove_nvmet_subsystem "${subsys}2" + + genctr=$(checkgenctr "${genctr}" "removing a subsystem from a port") + + _remove_nvmet_subsystem_from_port "${port}" "${subsys}1" + _remove_nvmet_subsystem "${subsys}1" + + _remove_nvmet_port "${port}" + + modprobe -r nvme-loop + modprobe -r nvmet + + echo "Test complete" +} diff --git a/tests/nvme/030.out b/tests/nvme/030.out new file mode 100644 index 000000000000..93e51905b5d4 --- /dev/null +++ b/tests/nvme/030.out @@ -0,0 +1,2 @@ +Running nvme/030 +Test complete diff --git a/tests/nvme/rc b/tests/nvme/rc index 74e316248ef5..7be6c903611b 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -124,3 +124,8 @@ _filter_discovery() { -e '/Discovery Log Number|Log Entry|trtype|subnqn/p' } + +_discovery_genctr() { + nvme discover -t loop | + sed -n -e 's/^.*Generation counter \([0-9]\+\).*$/\1/p' +} -- 2.17.1
next prev parent reply other threads:[~2019-07-17 17:13 UTC|newest] Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-07-17 17:12 [PATCH blktests v2 00/12] Fix nvme block test issues Logan Gunthorpe 2019-07-17 17:12 ` Logan Gunthorpe 2019-07-17 17:12 ` [PATCH blktests v2 01/12] Add filter function for nvme discover Logan Gunthorpe 2019-07-17 17:12 ` Logan Gunthorpe 2019-07-18 6:58 ` Johannes Thumshirn 2019-07-18 6:58 ` Johannes Thumshirn 2019-07-17 17:12 ` [PATCH blktests v2 02/12] nvme: More agressively filter the discovery output Logan Gunthorpe 2019-07-18 6:59 ` Johannes Thumshirn 2019-07-18 6:59 ` Johannes Thumshirn 2019-07-17 17:12 ` Logan Gunthorpe [this message] 2019-07-17 17:12 ` [PATCH blktests v2 03/12] nvme: Add new test to verify the generation counter Logan Gunthorpe 2019-07-18 7:03 ` Johannes Thumshirn 2019-07-18 7:03 ` Johannes Thumshirn 2019-07-18 15:55 ` Logan Gunthorpe 2019-07-18 15:55 ` Logan Gunthorpe 2019-07-17 17:12 ` [PATCH blktests v2 04/12] nvme/003,004: Add missing calls to nvme disconnect Logan Gunthorpe 2019-07-17 17:12 ` [PATCH blktests v2 04/12] nvme/003, 004: " Logan Gunthorpe 2019-07-18 7:03 ` [PATCH blktests v2 04/12] nvme/003,004: " Johannes Thumshirn 2019-07-18 7:03 ` Johannes Thumshirn 2019-07-17 17:12 ` [PATCH blktests v2 05/12] nvme/005: Don't rely on modprobing to set the multipath paramater Logan Gunthorpe 2019-07-17 17:12 ` Logan Gunthorpe 2019-07-18 7:04 ` Johannes Thumshirn 2019-07-18 7:04 ` Johannes Thumshirn 2019-07-17 17:12 ` [PATCH blktests v2 06/12] nvme/015: Ensure the namespace is flushed not the char device Logan Gunthorpe 2019-07-17 17:12 ` Logan Gunthorpe 2019-07-18 7:04 ` Johannes Thumshirn 2019-07-18 7:04 ` Johannes Thumshirn 2019-07-17 17:12 ` [PATCH blktests v2 07/12] nvme/018: Ignore error message generated by nvme read Logan Gunthorpe 2019-07-17 17:12 ` Logan Gunthorpe 2019-07-18 7:05 ` Johannes Thumshirn 2019-07-18 7:05 ` Johannes Thumshirn 2019-07-17 17:12 ` [PATCH blktests v2 08/12] check: Add the ability to call a cleanup function after a test ends Logan Gunthorpe 2019-07-17 17:12 ` Logan Gunthorpe 2019-07-18 7:07 ` Johannes Thumshirn 2019-07-18 7:07 ` Johannes Thumshirn 2019-07-17 17:12 ` [PATCH blktests v2 09/12] nvme: Cleanup modprobe lines into helper functions Logan Gunthorpe 2019-07-17 17:12 ` Logan Gunthorpe 2019-07-18 7:07 ` Johannes Thumshirn 2019-07-18 7:07 ` Johannes Thumshirn 2019-07-17 17:12 ` [PATCH blktests v2 10/12] nvme: Ensure all ports and subsystems are removed on cleanup Logan Gunthorpe 2019-07-17 17:12 ` Logan Gunthorpe 2019-07-18 7:08 ` Johannes Thumshirn 2019-07-18 7:08 ` Johannes Thumshirn 2019-07-17 17:12 ` [PATCH blktests v2 11/12] common: Use sysfs instead of modinfo for _have_module_param() Logan Gunthorpe 2019-07-17 17:12 ` Logan Gunthorpe 2019-07-18 7:08 ` Johannes Thumshirn 2019-07-18 7:08 ` Johannes Thumshirn 2019-07-17 17:12 ` [PATCH blktests v2 12/12] nvme: Ignore errors when removing modules Logan Gunthorpe 2019-07-17 17:12 ` Logan Gunthorpe 2019-07-18 7:09 ` Johannes Thumshirn 2019-07-18 7:09 ` Johannes Thumshirn 2019-07-29 17:31 ` [PATCH blktests v2 00/12] Fix nvme block test issues Omar Sandoval 2019-07-29 17:31 ` Omar Sandoval
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=20190717171259.3311-4-logang@deltatee.com \ --to=logang@deltatee.com \ --cc=chaitanya.kulkarni@wdc.com \ --cc=jthumshirn@suse.de \ --cc=linux-block@vger.kernel.org \ --cc=linux-nvme@lists.infradead.org \ --cc=mmoese@suse.de \ --cc=osandov@fb.com \ --cc=sbates@raithlin.com \ --cc=tytso@mit.edu \ /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: linkBe 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.