Running tests at high parallelism on a slow machine, 5 sec is not enough to wait for p4d to start. Change it to 5 minutes, adding an environment variable P4D_START_PATIENCE to shrink that if needed in automated test environments. Also check if the pid of the p4d that we started is still around. If not, quit waiting for it immediately. Signed-off-by: Pete Wyckoff <pw@xxxxxxxx> --- t/lib-git-p4.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh index 121e380..2e3706a 100644 --- a/t/lib-git-p4.sh +++ b/t/lib-git-p4.sh @@ -33,14 +33,27 @@ pidfile="$TRASH_DIRECTORY/p4d.pid" start_p4d() { mkdir -p "$db" "$cli" "$git" && + rm -f "$pidfile" && ( p4d -q -r "$db" -p $P4DPORT & echo $! >"$pidfile" ) && - for i in 1 2 3 4 5 ; do + # This gives p4d a long time to start up, as it can be + # quite slow depending on the machine. Set this environment + # variable to something smaller to fail faster in, say, + # an automated test setup. + i=${P4D_START_PATIENCE:-300} && + while [ $i -gt 0 ]; do + # succeed when p4 client commands start to work p4 info >/dev/null 2>&1 && break || true && + # fail if pid goes away + if [ -f "$pidfile" ] ; then + kill -0 $(cat "$pidfile") || break + fi && + # else keep waiting echo waiting for p4d to start && - sleep 1 + sleep 1 && + i=$(($i - 1)) done && # complain if it never started p4 info >/dev/null && -- 1.7.11.1.69.gd505fd2 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html