Re: [PATCH blktests] nvmeof-mp/001: Set expected count properly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
> ---
>  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



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux