From 692fce32224970a4da644dffbc959b529fb3783d Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Wed, 26 Feb 2020 17:03:50 +0100 Subject: [PATCH] test/common: Introduce timeout in discover_bdevs() In case something goes awfully wrong with the test which calls this particular function, e.g: https://ci.spdk.io/results/autotest-per-patch/builds/4787 the CI's autotest runs may be blocked for max of 15 minutes before failing the build. Instead, introduce internal timeout for the routine itself (default of 30s) and fail the test sooner when it expires. Change-Id: I2c792c1781987e80e34c1fa19ec3eef43c25e38a Signed-off-by: Michal Berger Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1026 Tested-by: SPDK CI Jenkins Reviewed-by: Darek Stojaczyk Reviewed-by: Tomasz Zawadzki --- test/common/autotest_common.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/common/autotest_common.sh b/test/common/autotest_common.sh index 41dd3ed9f..653295e25 100644 --- a/test/common/autotest_common.sh +++ b/test/common/autotest_common.sh @@ -762,6 +762,7 @@ function discover_bdevs() local rootdir=$1 local config_file=$2 local cfg_type=$3 + local wait_for_spdk_bdev=${4:-30} local rpc_server=/var/tmp/spdk-discover-bdevs.sock if [ ! -e $config_file ]; then @@ -779,6 +780,8 @@ function discover_bdevs() $cfg_type $config_file &>/dev/null & stubpid=$! while ! [ -e /var/run/spdk_bdev0 ]; do + # If this counter drops to zero, errexit will be caught to abort the test + (( wait_for_spdk_bdev-- )) sleep 1 done