Linux-Block Archive on lore.kernel.org
 help / color / Atom feed
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 01/12] Add filter function for nvme discover
Date: Fri, 12 Jul 2019 17:57:31 -0600
Message-ID: <20190712235742.22646-2-logang@deltatee.com> (raw)
In-Reply-To: <20190712235742.22646-1-logang@deltatee.com>

From: Michael Moese <mmoese@suse.de>

Several NVMe tests (002, 016, 017) used a pipe to a sed call filtering
the output. This call is moved to a new filter function nvme/rc and
the calls to sed are replaced by this function.

Additionally, the test nvme/016 failed for me due to the Generation
counter being greater than 1, so the new filter function was expanded to
replace the Generation counter with 'X'.

Signed-off-by: Michael Moese <mmoese@suse.de>
[logang@deltatee.com: added missing changes to 002.out and 017.out]
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
---
 tests/nvme/002     | 2 +-
 tests/nvme/002.out | 2 +-
 tests/nvme/016     | 2 +-
 tests/nvme/016.out | 2 +-
 tests/nvme/017     | 2 +-
 tests/nvme/017.out | 2 +-
 tests/nvme/rc      | 5 +++++
 7 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/tests/nvme/002 b/tests/nvme/002
index 106a5a8395f2..ceac1c677bd4 100755
--- a/tests/nvme/002
+++ b/tests/nvme/002
@@ -32,7 +32,7 @@ test() {
 		_add_nvmet_subsys_to_port "${port}" "blktests-subsystem-$i"
 	done
 
-	nvme discover -t loop | sed -r -e "s/portid:  [0-9]+/portid:  X/"
+	nvme discover -t loop | _filter_discovery
 
 	for ((i = iterations - 1; i >= 0; i--)); do
 		_remove_nvmet_subsystem_from_port "${port}" "blktests-subsystem-$i"
diff --git a/tests/nvme/002.out b/tests/nvme/002.out
index aa71d8f5f5f8..7437a21f60a9 100644
--- a/tests/nvme/002.out
+++ b/tests/nvme/002.out
@@ -1,6 +1,6 @@
 Running nvme/002
 
-Discovery Log Number of Records 1000, Generation counter 1000
+Discovery Log Number of Records 1000, Generation counter X
 =====Discovery Log Entry 0======
 trtype:  loop
 adrfam:  pci
diff --git a/tests/nvme/016 b/tests/nvme/016
index 966d5dc0a4a2..dd1b84a16daa 100755
--- a/tests/nvme/016
+++ b/tests/nvme/016
@@ -34,7 +34,7 @@ test() {
 	port="$(_create_nvmet_port "loop")"
 	_add_nvmet_subsys_to_port "$port" "${subsys_nqn}"
 
-	nvme discover -t loop | sed -r -e "s/portid:  [0-9]+/portid:  X/"
+	nvme discover -t loop | _filter_discovery
 	_remove_nvmet_subsystem_from_port "${port}" "${subsys_nqn}"
 	_remove_nvmet_port "${port}"
 
diff --git a/tests/nvme/016.out b/tests/nvme/016.out
index 59bd2935346f..b70603144d5c 100644
--- a/tests/nvme/016.out
+++ b/tests/nvme/016.out
@@ -1,6 +1,6 @@
 Running nvme/016
 
-Discovery Log Number of Records 1, Generation counter 1
+Discovery Log Number of Records 1, Generation counter X
 =====Discovery Log Entry 0======
 trtype:  loop
 adrfam:  pci
diff --git a/tests/nvme/017 b/tests/nvme/017
index 0b86bece9520..5f8d60907293 100755
--- a/tests/nvme/017
+++ b/tests/nvme/017
@@ -37,7 +37,7 @@ test() {
 	port="$(_create_nvmet_port "loop")"
 	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
 
-	nvme discover -t loop | sed -r -e "s/portid:  [0-9]+/portid:  X/"
+	nvme discover -t loop | _filter_discovery
 	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
 	_remove_nvmet_port "${port}"
 
diff --git a/tests/nvme/017.out b/tests/nvme/017.out
index 4b0877aaf3ca..cf212971d180 100644
--- a/tests/nvme/017.out
+++ b/tests/nvme/017.out
@@ -1,6 +1,6 @@
 Running nvme/017
 
-Discovery Log Number of Records 1, Generation counter 1
+Discovery Log Number of Records 1, Generation counter X
 =====Discovery Log Entry 0======
 trtype:  loop
 adrfam:  pci
diff --git a/tests/nvme/rc b/tests/nvme/rc
index eff1dd992460..22833d8ef9bb 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -118,3 +118,8 @@ _find_nvme_loop_dev() {
 		fi
 	done
 }
+
+_filter_discovery() {
+	sed -r  -e "s/portid:  [0-9]+/portid:  X/" \
+		-e "s/Generation counter [0-9]+/Generation counter X/"
+}
-- 
2.17.1


  reply index

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-12 23:57 [PATCH blktests 00/12] Fix nvme block test issues Logan Gunthorpe
2019-07-12 23:57 ` Logan Gunthorpe [this message]
2019-07-12 23:57 ` [PATCH blktests 03/12] nvme: Add new test to verify the generation counter Logan Gunthorpe
2019-07-12 23:57 ` [PATCH blktests 04/12] nvme/003,004: Add missing calls to nvme disconnect Logan Gunthorpe
2019-07-12 23:57 ` [PATCH blktests 05/12] nvme/005: Don't rely on modprobing to set the multipath paramater Logan Gunthorpe
2019-07-12 23:57 ` [PATCH blktests 06/12] nvme/015: Ensure the namespace is flushed not the char device Logan Gunthorpe
2019-07-12 23:57 ` [PATCH blktests 07/12] nvme/018: Ignore error message generated by nvme read Logan Gunthorpe
2019-07-15  7:15   ` [PATCH blktests 07/12] nvme/018: Ignore error message generated by nvme read] Johannes Thumshirn
2019-07-15 15:40     ` Logan Gunthorpe
2019-07-12 23:57 ` [PATCH blktests 08/12] check: Add the ability to call a cleanup function after a test ends Logan Gunthorpe
2019-07-12 23:57 ` [PATCH blktests 09/12] nvme: Cleanup modprobe lines into helper functions Logan Gunthorpe
2019-07-12 23:57 ` [PATCH blktests 10/12] nvme: Ensure all ports and subsystems are removed on cleanup Logan Gunthorpe
2019-07-12 23:57 ` [PATCH blktests 11/12] common: Use sysfs instead of modinfo for _have_module_param() Logan Gunthorpe
2019-07-15  7:21   ` Johannes Thumshirn
2019-07-15 15:41     ` Logan Gunthorpe
2019-07-12 23:57 ` [PATCH blktests 12/12] nvme: Ignore errors when removing modules Logan Gunthorpe
2019-07-13  0:01 ` [PATCH blktests 00/12] Fix nvme block test issues Logan Gunthorpe
2019-07-15 17:14 ` Chaitanya Kulkarni
     [not found] ` <20190712235742.22646-3-logang@deltatee.com>
2019-07-15 23:07   ` [PATCH blktests 02/12] nvme: More agressively filter the discovery output Omar Sandoval
2019-07-15 23:14 ` [PATCH blktests 00/12] Fix nvme block test issues Omar Sandoval
2019-07-15 23:16   ` Logan Gunthorpe

Reply instructions:

You may reply publically 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=20190712235742.22646-2-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: link

Linux-Block Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-block/0 linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ https://lore.kernel.org/linux-block \
		linux-block@vger.kernel.org linux-block@archiver.kernel.org
	public-inbox-index linux-block


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-block


AGPL code for this site: git clone https://public-inbox.org/ public-inbox