Commit 975e4614 authored by paul luse's avatar paul luse Committed by Darek Stojaczyk
Browse files

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: default avatarpaul luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456091


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 9c48768a
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -416,6 +416,21 @@ function waitfornbd() {
	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() {
	# $1 = process pid
	if [ -z "$1" ]; then