test/autotest_common: add new function waitforbdev()
Waits up to 2 seconds for a bdev to arrive, if not returns error. In the next patch in this series this is used and seems like a good general function. Change-Id: I3402f34f3dad3d7373973dc785520a5c4e58cd14 Signed-off-by: paul luse <paul.e.luse@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456091 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
9c48768aa0
commit
975e461496
@ -416,6 +416,21 @@ function waitfornbd() {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function waitforbdev() {
|
||||||
|
local bdev_name=$1
|
||||||
|
local i
|
||||||
|
|
||||||
|
for ((i=1; i<=20; i++)); do
|
||||||
|
if ! $rpc_py get_bdevs | jq -r '.[] .name' | grep -qw $bdev_name; then
|
||||||
|
sleep 0.1
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
function killprocess() {
|
function killprocess() {
|
||||||
# $1 = process pid
|
# $1 = process pid
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user