mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Wait up to timeout seconds for udev device
Occasional failures were observed in zconfig.sh because udev could be delayed for a few seconds. To handle this the wait_udev function has been added to wait for timeout seconds for an expected device before returning an error. By default callers currently use a 30 seconds timeout which should be much longer than udev ever needs but not so long to worry the test suite is hung.
This commit is contained in:
@@ -441,3 +441,20 @@ run_test() {
|
||||
skip_one_test ${TEST_NUM} "${TEST_NAME}"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_udev() {
|
||||
local DEVICE=$1
|
||||
local DELAY=$2
|
||||
local COUNT=0
|
||||
|
||||
while [ ! -e ${DEVICE} ]; do
|
||||
if [ ${COUNT} -gt ${DELAY} ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
let COUNT=${COUNT}+1
|
||||
sleep 1
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user