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:
parent
df00a867f4
commit
4674af01ed
@ -772,20 +772,24 @@ function process_shm() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Parameters:
|
||||||
|
# $1 - process pid
|
||||||
|
# $2 - rpc address (optional)
|
||||||
|
# $3 - max retries (optional)
|
||||||
function waitforlisten() {
|
function waitforlisten() {
|
||||||
# $1 = process pid
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local rpc_addr="${2:-$DEFAULT_RPC_ADDR}"
|
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..."
|
echo "Waiting for process to start up and listen on UNIX domain socket $rpc_addr..."
|
||||||
# turn off trace for this loop
|
# turn off trace for this loop
|
||||||
xtrace_disable
|
xtrace_disable
|
||||||
local ret=0
|
local ret=0
|
||||||
local i
|
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
|
# if the process is no longer running, then exit the script
|
||||||
# since it means the application crashed
|
# since it means the application crashed
|
||||||
if ! kill -s 0 $1; then
|
if ! kill -s 0 $1; then
|
||||||
|
Loading…
Reference in New Issue
Block a user