test/common: add max retries to waitforlisten

Signed-off-by: Pawel Piatek <pawelx.piatek@intel.com>
Change-Id: Iea99962431d9d59ac865c398673698d3c8802e28
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15149
Reviewed-by: Michal Berger <michal.berger@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Pawel Piatek 2022-10-26 13:13:55 +02:00 committed by Tomasz Zawadzki
parent df00a867f4
commit 4674af01ed

View File

@ -772,20 +772,24 @@ function process_shm() {
return 0
}
# Parameters:
# $1 - process pid
# $2 - rpc address (optional)
# $3 - max retries (optional)
function waitforlisten() {
# $1 = process pid
if [ -z "$1" ]; then
exit 1
fi
local rpc_addr="${2:-$DEFAULT_RPC_ADDR}"
local max_retries=${3:-100}
echo "Waiting for process to start up and listen on UNIX domain socket $rpc_addr..."
# turn off trace for this loop
xtrace_disable
local ret=0
local i
for ((i = 100; i != 0; i--)); do
for ((i = max_retries; i != 0; i--)); do
# if the process is no longer running, then exit the script
# since it means the application crashed
if ! kill -s 0 $1; then