All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiao Yang <yangx.jy@fujitsu.com>
To: <osandov@fb.com>, <yi.zhang@redhat.com>, <bvanassche@acm.org>,
	<shinichiro.kawasaki@wdc.com>
Cc: <linux-block@vger.kernel.org>, Xiao Yang <yangx.jy@fujitsu.com>
Subject: [PATCH blktests v2] nvmeof-mp/001: Set expected count properly
Date: Sat, 21 May 2022 20:30:20 +0800	[thread overview]
Message-ID: <20220521123020.90046-1-yangx.jy@fujitsu.com> (raw)

The number of block devices will increase according
to the number of RDMA-capable NICs.
For example, nvmeof-mp/001 with two RDMA-capable NICs
got the following error:
-------------------------------------
    Configured NVMe target driver
    -count_devices(): 1 <> 1
    +count_devices(): 2 <> 1
    Passed
-------------------------------------

Set expected count properly by calculating the number
of RDMA-capable NICs.

Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
---
 tests/nvmeof-mp/001     | 11 +++++++----
 tests/nvmeof-mp/001.out |  1 -
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/tests/nvmeof-mp/001 b/tests/nvmeof-mp/001
index f3e6394..70a4455 100755
--- a/tests/nvmeof-mp/001
+++ b/tests/nvmeof-mp/001
@@ -18,17 +18,20 @@ count_devices() {
 }
 
 wait_for_devices() {
-	local expected=1 i devices
+	local expected=0 i devices
+
+	for i in $(rdma_network_interfaces); do
+		((expected++))
+	done
 
 	use_blk_mq y || return $?
 	for ((i=0;i<100;i++)); do
 		devices=$(count_devices)
-		[ "$devices" -ge $expected ] && break
+		[ "$devices" -ge "$expected" ] && break
 		sleep .1
 	done
 	echo "count_devices(): $devices <> $expected" >>"$FULL"
-	echo "count_devices(): $devices <> $expected"
-	[ "$devices" -ge $expected ]
+	[ "$devices" -ge "$expected" ]
 }
 
 test() {
diff --git a/tests/nvmeof-mp/001.out b/tests/nvmeof-mp/001.out
index 2ce8d17..a7d4cb9 100644
--- a/tests/nvmeof-mp/001.out
+++ b/tests/nvmeof-mp/001.out
@@ -1,3 +1,2 @@
 Configured NVMe target driver
-count_devices(): 1 <> 1
 Passed
-- 
2.34.1




             reply	other threads:[~2022-05-21 12:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-21 12:30 Xiao Yang [this message]
2022-05-23  1:09 ` [PATCH blktests v2] nvmeof-mp/001: Set expected count properly Shinichiro Kawasaki
2022-05-26  7:36 ` Shinichiro Kawasaki

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=20220521123020.90046-1-yangx.jy@fujitsu.com \
    --to=yangx.jy@fujitsu.com \
    --cc=bvanassche@acm.org \
    --cc=linux-block@vger.kernel.org \
    --cc=osandov@fb.com \
    --cc=shinichiro.kawasaki@wdc.com \
    --cc=yi.zhang@redhat.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 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.