]> www.infradead.org Git - users/hch/blktests.git/commitdiff
Make the NVMe tests more reliable
authorBart Van Assche <bvanassche@acm.org>
Mon, 5 Aug 2019 23:25:12 +0000 (16:25 -0700)
committerOmar Sandoval <osandov@osandov.com>
Wed, 7 Aug 2019 17:16:19 +0000 (10:16 -0700)
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>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
tests/nvme/rc

index 348b4a3c2cbc4b9cb49e5a550fa8f6220ab2f848..d4e18e635dea6379946c0406770966b330bf922d 100644 (file)
@@ -169,6 +169,13 @@ _find_nvme_loop_dev() {
                transport="$(cat "/sys/class/nvme/${dev}/transport")"
                if [[ "$transport" == "loop" ]]; then
                        echo "$dev"
+                       for ((i = 0; i < 10; i++)); do
+                               if [[ -e /sys/block/$dev/uuid &&
+                                       -e /sys/block/$dev/wwid ]]; then
+                                       return
+                               fi
+                               sleep .1
+                       done
                fi
        done
 }