All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH blktests] nvmeof-mp/001: Set expected count properly
@ 2022-05-18  3:44 Xiao Yang
  2022-05-18 11:54 ` Bart Van Assche
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Xiao Yang @ 2022-05-18  3:44 UTC (permalink / raw)
  To: osandov, yi.zhang, bvanassche; +Cc: linux-block, Xiao Yang

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     | 7 +++++--
 tests/nvmeof-mp/001.out | 1 -
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/nvmeof-mp/001 b/tests/nvmeof-mp/001
index f3e6394..82cb298 100755
--- a/tests/nvmeof-mp/001
+++ b/tests/nvmeof-mp/001
@@ -18,7 +18,11 @@ 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
@@ -27,7 +31,6 @@ wait_for_devices() {
 		sleep .1
 	done
 	echo "count_devices(): $devices <> $expected" >>"$FULL"
-	echo "count_devices(): $devices <> $expected"
 	[ "$devices" -ge $expected ]
 }
 
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




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH blktests] nvmeof-mp/001: Set expected count properly
  2022-05-18  3:44 [PATCH blktests] nvmeof-mp/001: Set expected count properly Xiao Yang
@ 2022-05-18 11:54 ` Bart Van Assche
  2022-05-18 12:03 ` Yi Zhang
  2022-05-20  9:37 ` Shinichiro Kawasaki
  2 siblings, 0 replies; 5+ messages in thread
From: Bart Van Assche @ 2022-05-18 11:54 UTC (permalink / raw)
  To: Xiao Yang, osandov, yi.zhang; +Cc: linux-block

On 5/18/22 05:44, Xiao Yang wrote:
> 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.

Reviewed-by: Bart Van Assche <bvanassche@acm.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH blktests] nvmeof-mp/001: Set expected count properly
  2022-05-18  3:44 [PATCH blktests] nvmeof-mp/001: Set expected count properly Xiao Yang
  2022-05-18 11:54 ` Bart Van Assche
@ 2022-05-18 12:03 ` Yi Zhang
  2022-05-20  9:37 ` Shinichiro Kawasaki
  2 siblings, 0 replies; 5+ messages in thread
From: Yi Zhang @ 2022-05-18 12:03 UTC (permalink / raw)
  To: Xiao Yang; +Cc: osandov, Bart Van Assche, linux-block

I also met this failure during my previous testing, thanks.

Reviewed-by: Yi Zhang <yi.zhang@redhat.com>

On Wed, May 18, 2022 at 11:44 AM Xiao Yang <yangx.jy@fujitsu.com> wrote:
>
> 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     | 7 +++++--
>  tests/nvmeof-mp/001.out | 1 -
>  2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/tests/nvmeof-mp/001 b/tests/nvmeof-mp/001
> index f3e6394..82cb298 100755
> --- a/tests/nvmeof-mp/001
> +++ b/tests/nvmeof-mp/001
> @@ -18,7 +18,11 @@ 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
> @@ -27,7 +31,6 @@ wait_for_devices() {
>                 sleep .1
>         done
>         echo "count_devices(): $devices <> $expected" >>"$FULL"
> -       echo "count_devices(): $devices <> $expected"
>         [ "$devices" -ge $expected ]
>  }
>
> 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
>
>
>


-- 
Best Regards,
  Yi Zhang


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH blktests] nvmeof-mp/001: Set expected count properly
  2022-05-18  3:44 [PATCH blktests] nvmeof-mp/001: Set expected count properly Xiao Yang
  2022-05-18 11:54 ` Bart Van Assche
  2022-05-18 12:03 ` Yi Zhang
@ 2022-05-20  9:37 ` Shinichiro Kawasaki
  2022-05-21 12:27   ` yangx.jy
  2 siblings, 1 reply; 5+ messages in thread
From: Shinichiro Kawasaki @ 2022-05-20  9:37 UTC (permalink / raw)
  To: Xiao Yang; +Cc: osandov, yi.zhang, bvanassche, linux-block

On May 18, 2022 / 11:44, Xiao Yang wrote:
> 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     | 7 +++++--
>  tests/nvmeof-mp/001.out | 1 -
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/nvmeof-mp/001 b/tests/nvmeof-mp/001
> index f3e6394..82cb298 100755
> --- a/tests/nvmeof-mp/001
> +++ b/tests/nvmeof-mp/001
> @@ -18,7 +18,11 @@ 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
> @@ -27,7 +31,6 @@ wait_for_devices() {
>  		sleep .1
>  	done
>  	echo "count_devices(): $devices <> $expected" >>"$FULL"
> -	echo "count_devices(): $devices <> $expected"
>  	[ "$devices" -ge $expected ]

The change looks good for me other than a nit: after applying this patch,
shellcheck complains:

$ make check
shellcheck -x -e SC2119 -f gcc check new common/* \
        tests/*/rc tests/*/[0-9]*[0-9]
tests/nvmeof-mp/001:30:20: note: Double quote to prevent globbing and word splitting. [SC2086]
tests/nvmeof-mp/001:34:19: note: Double quote to prevent globbing and word splitting. [SC2086]

As the commit changes value of the variable $expected, its references need
double quotes:

diff --git a/tests/nvmeof-mp/001 b/tests/nvmeof-mp/001
index 82cb298..70a4455 100755
--- a/tests/nvmeof-mp/001
+++ b/tests/nvmeof-mp/001
@@ -27,11 +27,11 @@ wait_for_devices() {
        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"
-       [ "$devices" -ge $expected ]
+       [ "$devices" -ge "$expected" ]
 }

 test() {

-- 
Best Regards,
Shin'ichiro Kawasaki

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH blktests] nvmeof-mp/001: Set expected count properly
  2022-05-20  9:37 ` Shinichiro Kawasaki
@ 2022-05-21 12:27   ` yangx.jy
  0 siblings, 0 replies; 5+ messages in thread
From: yangx.jy @ 2022-05-21 12:27 UTC (permalink / raw)
  To: Shinichiro Kawasaki; +Cc: osandov, yi.zhang, bvanassche, linux-block

On 2022/5/20 17:37, Shinichiro Kawasaki wrote:
> The change looks good for me other than a nit: after applying this patch,
> shellcheck complains:
> 
> $ make check
> shellcheck -x -e SC2119 -f gcc check new common/* \
>          tests/*/rc tests/*/[0-9]*[0-9]
> tests/nvmeof-mp/001:30:20: note: Double quote to prevent globbing and word splitting. [SC2086]
> tests/nvmeof-mp/001:34:19: note: Double quote to prevent globbing and word splitting. [SC2086]
> 
> As the commit changes value of the variable $expected, its references need
> double quotes:

Hi Shinichiro,

Good catch. I will fix it as you suggested.

Best Regards,
Xiao Yang

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-05-21 12:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-18  3:44 [PATCH blktests] nvmeof-mp/001: Set expected count properly Xiao Yang
2022-05-18 11:54 ` Bart Van Assche
2022-05-18 12:03 ` Yi Zhang
2022-05-20  9:37 ` Shinichiro Kawasaki
2022-05-21 12:27   ` yangx.jy

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.