linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH blktests] Make the NVMe tests more reliable
@ 2019-08-05 23:25 Bart Van Assche
  2019-08-06  8:11 ` Johannes Thumshirn
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Bart Van Assche @ 2019-08-05 23:25 UTC (permalink / raw)
  To: Omar Sandoval
  Cc: linux-block, Bart Van Assche, Logan Gunthorpe,
	Chaitanya Kulkarni, Johannes Thumshirn

When running blktests with kernel debugging enabled it can happen that
_find_nvme_loop_dev() returns before the NVMe block device has appeared
in sysfs. This patch avoids that the NVMe tests fail as follows:

+cat: /sys/block/nvme1n1/uuid: No such file or directory
+cat: /sys/block/nvme1n1/wwid: No such file or directory

Cc: Logan Gunthorpe <logang@deltatee.com>
Cc: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 tests/nvme/rc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tests/nvme/rc b/tests/nvme/rc
index 348b4a3c2cbc..05dfc5915a13 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -169,8 +169,16 @@ _find_nvme_loop_dev() {
 		transport="$(cat "/sys/class/nvme/${dev}/transport")"
 		if [[ "$transport" == "loop" ]]; then
 			echo "$dev"
+			for ((i=0;i<10;i++)); do
+				[ -e /sys/block/$dev/uuid ] &&
+					[ -e /sys/block/$dev/wwid ] &&
+					return 0
+				sleep .1
+			done
+			return 1
 		fi
 	done
+	return 1
 }
 
 _filter_discovery() {
-- 
2.22.0.770.g0f2c4a37fd-goog


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

* Re: [PATCH blktests] Make the NVMe tests more reliable
  2019-08-05 23:25 [PATCH blktests] Make the NVMe tests more reliable Bart Van Assche
@ 2019-08-06  8:11 ` Johannes Thumshirn
  2019-08-06 15:11   ` Bart Van Assche
  2019-08-06 15:43 ` Logan Gunthorpe
  2019-08-07 17:23 ` Omar Sandoval
  2 siblings, 1 reply; 6+ messages in thread
From: Johannes Thumshirn @ 2019-08-06  8:11 UTC (permalink / raw)
  To: Bart Van Assche, Omar Sandoval
  Cc: linux-block, Logan Gunthorpe, Chaitanya Kulkarni

On 06/08/2019 01:25, Bart Van Assche wrote:
[...]

> +			for ((i=0;i<10;i++)); do
> +				[ -e /sys/block/$dev/uuid ] &&
> +					[ -e /sys/block/$dev/wwid ] &&
> +					return 0
> +				sleep .1
> +			done
> +			return 1
>  		fi
>  	done
> +	return 1

Hmmm, I don't really understand why you're adding the return {0,1} here.
None of the callers of _find_nvme_loop_dev() does anything with the
return value of the function.

They expect either a nvme-device or an empty string and fail if the
string is empty due to a non-empty diff in the golden output.

Thanks,
	Johannes
-- 
Johannes Thumshirn                            SUSE Labs Filesystems
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

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

* Re: [PATCH blktests] Make the NVMe tests more reliable
  2019-08-06  8:11 ` Johannes Thumshirn
@ 2019-08-06 15:11   ` Bart Van Assche
  2019-08-07  7:14     ` Johannes Thumshirn
  0 siblings, 1 reply; 6+ messages in thread
From: Bart Van Assche @ 2019-08-06 15:11 UTC (permalink / raw)
  To: Johannes Thumshirn, Omar Sandoval
  Cc: linux-block, Logan Gunthorpe, Chaitanya Kulkarni

On 8/6/19 1:11 AM, Johannes Thumshirn wrote:
> On 06/08/2019 01:25, Bart Van Assche wrote:
> [...]
> 
>> +			for ((i=0;i<10;i++)); do
>> +				[ -e /sys/block/$dev/uuid ] &&
>> +					[ -e /sys/block/$dev/wwid ] &&
>> +					return 0
>> +				sleep .1
>> +			done
>> +			return 1
>>   		fi
>>   	done
>> +	return 1
> 
> Hmmm, I don't really understand why you're adding the return {0,1} here.
> None of the callers of _find_nvme_loop_dev() does anything with the
> return value of the function.
> 
> They expect either a nvme-device or an empty string and fail if the
> string is empty due to a non-empty diff in the golden output.

Hi Johannes,

The "return 0" statement has been added to break out of the two 
for-loops. The first "return 1" statement has been added to make sure 
that the echo "$dev" statement is executed at most once. The final 
"return 1" statement has been added to make the return value consistent.

Do you perhaps want me to leave out {0,1} from the return statements?

Bart.

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

* Re: [PATCH blktests] Make the NVMe tests more reliable
  2019-08-05 23:25 [PATCH blktests] Make the NVMe tests more reliable Bart Van Assche
  2019-08-06  8:11 ` Johannes Thumshirn
@ 2019-08-06 15:43 ` Logan Gunthorpe
  2019-08-07 17:23 ` Omar Sandoval
  2 siblings, 0 replies; 6+ messages in thread
From: Logan Gunthorpe @ 2019-08-06 15:43 UTC (permalink / raw)
  To: Bart Van Assche, Omar Sandoval
  Cc: linux-block, Chaitanya Kulkarni, Johannes Thumshirn



On 2019-08-05 5:25 p.m., Bart Van Assche wrote:
> When running blktests with kernel debugging enabled it can happen that
> _find_nvme_loop_dev() returns before the NVMe block device has appeared
> in sysfs. This patch avoids that the NVMe tests fail as follows:
> 
> +cat: /sys/block/nvme1n1/uuid: No such file or directory
> +cat: /sys/block/nvme1n1/wwid: No such file or directory
> 
> Cc: Logan Gunthorpe <logang@deltatee.com>
> Cc: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> Cc: Johannes Thumshirn <jthumshirn@suse.de>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

Makes sense to me.

Reviewed-by: Logan Gunthorpe <logang@deltatee.com>

> ---
>  tests/nvme/rc | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/tests/nvme/rc b/tests/nvme/rc
> index 348b4a3c2cbc..05dfc5915a13 100644
> --- a/tests/nvme/rc
> +++ b/tests/nvme/rc
> @@ -169,8 +169,16 @@ _find_nvme_loop_dev() {
>  		transport="$(cat "/sys/class/nvme/${dev}/transport")"
>  		if [[ "$transport" == "loop" ]]; then
>  			echo "$dev"
> +			for ((i=0;i<10;i++)); do
> +				[ -e /sys/block/$dev/uuid ] &&
> +					[ -e /sys/block/$dev/wwid ] &&
> +					return 0
> +				sleep .1
> +			done
> +			return 1
>  		fi
>  	done
> +	return 1
>  }
>  
>  _filter_discovery() {
> 

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

* Re: [PATCH blktests] Make the NVMe tests more reliable
  2019-08-06 15:11   ` Bart Van Assche
@ 2019-08-07  7:14     ` Johannes Thumshirn
  0 siblings, 0 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2019-08-07  7:14 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Omar Sandoval, linux-block, Logan Gunthorpe, Chaitanya Kulkarni

On Tue, Aug 06, 2019 at 08:11:02AM -0700, Bart Van Assche wrote:
> On 8/6/19 1:11 AM, Johannes Thumshirn wrote:
> > On 06/08/2019 01:25, Bart Van Assche wrote:
> > [...]
> > 
> > > +			for ((i=0;i<10;i++)); do
> > > +				[ -e /sys/block/$dev/uuid ] &&
> > > +					[ -e /sys/block/$dev/wwid ] &&
> > > +					return 0
> > > +				sleep .1
> > > +			done
> > > +			return 1
> > >   		fi
> > >   	done
> > > +	return 1
> > 
> > Hmmm, I don't really understand why you're adding the return {0,1} here.
> > None of the callers of _find_nvme_loop_dev() does anything with the
> > return value of the function.
> > 
> > They expect either a nvme-device or an empty string and fail if the
> > string is empty due to a non-empty diff in the golden output.
> 
> Hi Johannes,
> 
> The "return 0" statement has been added to break out of the two for-loops.
> The first "return 1" statement has been added to make sure that the echo
> "$dev" statement is executed at most once. The final "return 1" statement
> has been added to make the return value consistent.
> 
> Do you perhaps want me to leave out {0,1} from the return statements?

Yes, I think this is less confusing for readers.

With that,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>

-- 
Johannes Thumshirn                            SUSE Labs Filesystems
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

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

* Re: [PATCH blktests] Make the NVMe tests more reliable
  2019-08-05 23:25 [PATCH blktests] Make the NVMe tests more reliable Bart Van Assche
  2019-08-06  8:11 ` Johannes Thumshirn
  2019-08-06 15:43 ` Logan Gunthorpe
@ 2019-08-07 17:23 ` Omar Sandoval
  2 siblings, 0 replies; 6+ messages in thread
From: Omar Sandoval @ 2019-08-07 17:23 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Omar Sandoval, linux-block, Logan Gunthorpe, Chaitanya Kulkarni,
	Johannes Thumshirn

On Mon, Aug 05, 2019 at 04:25:12PM -0700, Bart Van Assche wrote:
> When running blktests with kernel debugging enabled it can happen that
> _find_nvme_loop_dev() returns before the NVMe block device has appeared
> in sysfs. This patch avoids that the NVMe tests fail as follows:
> 
> +cat: /sys/block/nvme1n1/uuid: No such file or directory
> +cat: /sys/block/nvme1n1/wwid: No such file or directory
> 
> Cc: Logan Gunthorpe <logang@deltatee.com>
> Cc: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> Cc: Johannes Thumshirn <jthumshirn@suse.de>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  tests/nvme/rc | 8 ++++++++
>  1 file changed, 8 insertions(+)

Thanks, Bart, I made Johannes' suggested change and applied.

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

end of thread, other threads:[~2019-08-07 17:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-05 23:25 [PATCH blktests] Make the NVMe tests more reliable Bart Van Assche
2019-08-06  8:11 ` Johannes Thumshirn
2019-08-06 15:11   ` Bart Van Assche
2019-08-07  7:14     ` Johannes Thumshirn
2019-08-06 15:43 ` Logan Gunthorpe
2019-08-07 17:23 ` Omar Sandoval

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).