From: Peter Eisentraut Date: Thu, 1 Aug 2019 19:24:57 +0000 (+0200) Subject: Sync ssl/test.sh with test.sh X-Git-Tag: pgbouncer_1_11_0~31 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=21e02ae9df33b047a9af1d11738504e3cfec8ea2;p=pgbouncer Sync ssl/test.sh with test.sh Make locations for logs and pid files consistent. --- diff --git a/.gitignore b/.gitignore index 86619ef..a0eb45e 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,11 @@ /test/pgdata/ /test/test.log /test/test.pid +/test/ssl/log +/test/ssl/tmp/ +/test/ssl/pgdata/ +/test/ssl/test.log +/test/ssl/test.pid /test/ssl/TestCA1/ *.html diff --git a/test/ssl/test.ini b/test/ssl/test.ini index a3aa247..feb4434 100644 --- a/test/ssl/test.ini +++ b/test/ssl/test.ini @@ -11,8 +11,8 @@ p1 = port=6666 host=localhost dbname=p1 user=bouncer ;;; Administrative settings ;;; -logfile = tmp/test.log -pidfile = tmp/test.pid +logfile = test.log +pidfile = test.pid ;;; ;;; Where to wait for clients diff --git a/test/ssl/test.sh b/test/ssl/test.sh index 35c57c4..a817e05 100755 --- a/test/ssl/test.sh +++ b/test/ssl/test.sh @@ -1,5 +1,7 @@ #! /bin/sh +cd $(dirname $0) + rm -rf TestCA1 ( @@ -17,13 +19,13 @@ export EF_ALLOW_MALLOC_0=1 mkdir -p tmp -BOUNCER_LOG=tmp/test.log +BOUNCER_LOG=test.log BOUNCER_INI=test.ini -BOUNCER_PID=tmp/test.pid +BOUNCER_PID=test.pid BOUNCER_PORT=`sed -n '/^listen_port/s/listen_port.*=[^0-9]*//p' $BOUNCER_INI` BOUNCER_EXE="../../pgbouncer" -LOGDIR=tmp +LOGDIR=log PG_PORT=6666 PG_LOG=$LOGDIR/pg.log @@ -31,16 +33,15 @@ pgctl() { pg_ctl -o "-p $PG_PORT" -D $PGDATA $@ >>$PG_LOG 2>&1 } -rm -f core ulimit -c unlimited -for f in pgdata/postmaster.pid tmp/test.pid; do - test -f $f && { kill `cat $f` || true; } +for f in pgdata/postmaster.pid test.pid; do + test -f $f && { kill `head -n1 $f` || true; } done mkdir -p $LOGDIR -rm -fr $BOUNCER_LOG $PG_LOG -rm -fr $PGDATA +rm -f $BOUNCER_LOG $PG_LOG +rm -rf $PGDATA if [ ! -d $PGDATA ]; then echo "initdb" @@ -82,7 +83,7 @@ reconf_bouncer() { for ln in "$@"; do echo "$ln" >> tmp/test.ini done - test -f tmp/test.pid && kill `cat tmp/test.pid` + test -f test.pid && kill `cat test.pid` sleep 1 $BOUNCER_EXE -v -v -v -d tmp/test.ini } @@ -132,6 +133,7 @@ runtest() { echo "ok" else echo "FAILED" + cat $LOGDIR/$1.log | sed 's/^/# /' fi date >> $LOGDIR/$1.log diff --git a/test/test.sh b/test/test.sh index dcba8c3..505a683 100755 --- a/test/test.sh +++ b/test/test.sh @@ -79,7 +79,7 @@ rm -rf $PGDATA if [ ! -d $PGDATA ]; then mkdir $PGDATA - initdb >> $PG_LOG 2>&1 + initdb --nosync >> $PG_LOG 2>&1 sed $SED_ERE_OP -i "/unix_socket_director/s:.*(unix_socket_director.*=).*:\\1 '/tmp':" pgdata/postgresql.conf cat >>pgdata/postgresql.conf <<-EOF log_connections = on