1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-02-25 21:57:45 +03:00

tests: sleep first

Sleep a bit before checking /sys/block dir so the kernel has a moment to
actually put scsi debug device in it...

Some quite old kernels are in troubles with this plain searching grep
without sleep (namely 2.6.32)

modprobe scsi_debug
 <sleep .1>
grep -H scsi_debug /sys/block/*/device/model
modprobe -r scsi_debug
This commit is contained in:
Zdenek Kabelac 2017-12-13 16:17:56 +01:00
parent 3a841515af
commit 0bf1cc2320

View File

@ -703,10 +703,10 @@ prepare_scsi_debug_dev() {
modprobe scsi_debug dev_size_mb="$DEV_SIZE" "$@" num_tgts=1 || skip
for i in {1..20} ; do
DEBUG_DEV="/dev/$(grep -H scsi_debug /sys/block/*/device/model | cut -f4 -d /)"
test -b "$DEBUG_DEV" && break
sleep .1 # allow for async Linux SCSI device registration
done
DEBUG_DEV="/dev/$(grep -H scsi_debug /sys/block/sd*/device/model | cut -f4 -d /)"
test -b "$DEBUG_DEV" && break
done
test -b "$DEBUG_DEV" || return 1 # should not happen
# Create symlink to scsi_debug device in $DM_DEV_DIR