diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2015-05-04 10:14:52 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2015-05-04 10:14:52 +0200 |
commit | b09ac72624031a7d6d0b6416a067aa60584e0d6c (patch) | |
tree | d025722a100816eb044f038e4df4ed979a36925e | |
parent | 75aa3e951f2e22a790fe2425f3b3ef71f292be2e (diff) | |
download | lvm2-b09ac72624031a7d6d0b6416a067aa60584e0d6c.tar.gz |
tests: wait for scsi device to appear
Continue with test as soon as device appear (avoid 2s delay)
-rw-r--r-- | test/lib/aux.sh | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/test/lib/aux.sh b/test/lib/aux.sh index c01fb8052..d0a517344 100644 --- a/test/lib/aux.sh +++ b/test/lib/aux.sh @@ -48,7 +48,7 @@ prepare_clvmd() { LVM_LOG_FILE_EPOCH=CLVMD LVM_BINARY=$(which lvm) $run_valgrind clvmd -Isinglenode -d 1 -f & echo $! > LOCAL_CLVMD - for i in $(seq 1 100) ; do + for i in {1..100} ; do test $i -eq 100 && die "Startup of clvmd is too slow." test -e "$CLVMD_PIDFILE" && break sleep .2 @@ -74,7 +74,7 @@ prepare_dmeventd() { echo $! > LOCAL_DMEVENTD # FIXME wait for pipe in /var/run instead - for i in $(seq 1 100) ; do + for i in {1..100} ; do test $i -eq 100 && die "Startup of dmeventd is too slow." test -e "${DMEVENTD_PIDFILE}" && break sleep .2 @@ -369,6 +369,7 @@ prepare_loop() { prepare_scsi_debug_dev() { local DEV_SIZE=$1 local SCSI_DEBUG_PARAMS=${@:2} + local DEBUG_DEV rm -f debug.log strace.log test ! -f "SCSI_DEBUG_DEV" || return 0 @@ -384,9 +385,12 @@ prepare_scsi_debug_dev() { # last param wins.. so num_tgts=1 is imposed touch SCSI_DEBUG_DEV modprobe scsi_debug dev_size_mb=$DEV_SIZE $SCSI_DEBUG_PARAMS num_tgts=1 || skip - sleep 2 # allow for async Linux SCSI device registration - - local DEBUG_DEV="/dev/$(grep -H scsi_debug /sys/block/*/device/model | cut -f4 -d /)" + + 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 test -b "$DEBUG_DEV" || return 1 # should not happen # Create symlink to scsi_debug device in $DM_DEV_DIR |