Skip to content

Commit d02f0aa

Browse files
committed
Instead of waiting a fixed amount of time for the test postmaster to
start up, wait until a psql connection attempt succeeds. Per gripe from Jason Tishler.
1 parent 0e3793e commit d02f0aa

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

src/test/regress/pg_regress.sh

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/sh
2-
# $Header: /cvsroot/pgsql/src/test/regress/Attic/pg_regress.sh,v 1.22 2001/09/16 16:11:11 petere Exp $
2+
# $Header: /cvsroot/pgsql/src/test/regress/Attic/pg_regress.sh,v 1.23 2002/01/03 21:52:05 tgl Exp $
33

44
me=`basename $0`
55
: ${TMPDIR=/tmp}
@@ -353,6 +353,27 @@ then
353353
"$bindir/postmaster" -D "$PGDATA" -F $postmaster_options >"$LOGDIR/postmaster.log" 2>&1 &
354354
postmaster_pid=$!
355355

356+
# Wait till postmaster is able to accept connections (normally only
357+
# a second or so, but Cygwin is reportedly *much* slower). Don't
358+
# wait forever, however.
359+
i=0
360+
max=60
361+
until "$bindir/psql" $psql_options template1 </dev/null 2>/dev/null
362+
do
363+
i=`expr $i + 1`
364+
if [ $i -ge $max ]
365+
then
366+
break
367+
fi
368+
if kill -0 $postmaster_pid >/dev/null 2>&1
369+
then
370+
: still starting up
371+
else
372+
break
373+
fi
374+
sleep 1
375+
done
376+
356377
if kill -0 $postmaster_pid >/dev/null 2>&1
357378
then
358379
echo "running on port $PGPORT with pid $postmaster_pid"
@@ -364,9 +385,6 @@ then
364385
(exit 2); exit
365386
fi
366387

367-
# give postmaster some time to pass WAL recovery
368-
sleep 3
369-
370388
else # not temp-install
371389

372390
# If Unix sockets are not available, use the local host by default.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy