public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Omar Sandoval <osandov@fb.com>
Cc: linux-block@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
	Logan Gunthorpe <logang@deltatee.com>,
	Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>,
	Johannes Thumshirn <jthumshirn@suse.de>
Subject: [PATCH blktests] Make the NVMe tests more reliable
Date: Mon,  5 Aug 2019 16:25:12 -0700	[thread overview]
Message-ID: <20190805232512.50992-1-bvanassche@acm.org> (raw)

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


             reply	other threads:[~2019-08-05 23:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-05 23:25 Bart Van Assche [this message]
2019-08-06  8:11 ` [PATCH blktests] Make the NVMe tests more reliable 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

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=20190805232512.50992-1-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=chaitanya.kulkarni@wdc.com \
    --cc=jthumshirn@suse.de \
    --cc=linux-block@vger.kernel.org \
    --cc=logang@deltatee.com \
    --cc=osandov@fb.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox