mirror of
https://github.com/postgres/postgres.git
synced 2025-05-05 09:19:17 +03:00
Communicate PGPORT and PGHOST via environment, not command line
This commit is contained in:
parent
5ba666b848
commit
e05f15483b
@ -1,5 +1,5 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# $Header: /cvsroot/pgsql/src/test/regress/Attic/pg_regress.sh,v 1.3 2000/10/02 06:03:25 tgl Exp $
|
# $Header: /cvsroot/pgsql/src/test/regress/Attic/pg_regress.sh,v 1.4 2000/10/02 11:47:30 petere Exp $
|
||||||
|
|
||||||
me=`basename $0`
|
me=`basename $0`
|
||||||
: ${TMPDIR=/tmp}
|
: ${TMPDIR=/tmp}
|
||||||
@ -81,6 +81,9 @@ unset top_builddir
|
|||||||
unset temp_install
|
unset temp_install
|
||||||
unset multibyte
|
unset multibyte
|
||||||
|
|
||||||
|
export PGHOST
|
||||||
|
export PGPORT
|
||||||
|
|
||||||
dbname=regression
|
dbname=regression
|
||||||
hostname=`hostname` || hostname=localhost
|
hostname=`hostname` || hostname=localhost
|
||||||
|
|
||||||
@ -154,8 +157,6 @@ case $host_platform in
|
|||||||
unix_sockets=yes;;
|
unix_sockets=yes;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[ "$unix_sockets" = no ] && psql_options="$psql_options -h $PGHOST"
|
|
||||||
|
|
||||||
|
|
||||||
# ----------
|
# ----------
|
||||||
# Set up diff to ignore horizontal white space differences.
|
# Set up diff to ignore horizontal white space differences.
|
||||||
@ -257,7 +258,11 @@ then
|
|||||||
libdir=$temp_install/$libdir
|
libdir=$temp_install/$libdir
|
||||||
datadir=$temp_install/$datadir
|
datadir=$temp_install/$datadir
|
||||||
PGDATA=$temp_install/data
|
PGDATA=$temp_install/data
|
||||||
|
if [ "$unix_sockets" = no ]; then
|
||||||
PGHOST=$hostname
|
PGHOST=$hostname
|
||||||
|
else
|
||||||
|
unset PGHOST
|
||||||
|
fi
|
||||||
PGPORT=65432
|
PGPORT=65432
|
||||||
|
|
||||||
# ----------
|
# ----------
|
||||||
@ -314,7 +319,7 @@ then
|
|||||||
message "starting postmaster"
|
message "starting postmaster"
|
||||||
[ "$debug" = yes ] && postmaster_options="$postmaster_options -d 5"
|
[ "$debug" = yes ] && postmaster_options="$postmaster_options -d 5"
|
||||||
[ "$unix_sockets" = no ] && postmaster_options="$postmaster_options -i"
|
[ "$unix_sockets" = no ] && postmaster_options="$postmaster_options -i"
|
||||||
"$bindir/postmaster" -D "$PGDATA" -p "$PGPORT" -F $postmaster_options >"$LOGDIR/postmaster.log" 2>&1 &
|
"$bindir/postmaster" -D "$PGDATA" -F $postmaster_options >"$LOGDIR/postmaster.log" 2>&1 &
|
||||||
postmaster_pid=$!
|
postmaster_pid=$!
|
||||||
|
|
||||||
if kill -0 $postmaster_pid >/dev/null 2>&1
|
if kill -0 $postmaster_pid >/dev/null 2>&1
|
||||||
@ -333,13 +338,22 @@ then
|
|||||||
|
|
||||||
else # not temp-install
|
else # not temp-install
|
||||||
|
|
||||||
if [ -n "$PGHOST" ]; then
|
# If Unix sockets are not available, use the local host by default.
|
||||||
echo "(using postmaster on $PGHOST at port $PGPORT)"
|
[ "$unix_sockets" = no ] && ${PGHOST=$hostname}
|
||||||
|
|
||||||
|
if [ -n "$PGPORT" ]; then
|
||||||
|
port_info="port $PGPORT"
|
||||||
else
|
else
|
||||||
echo "(using postmaster on Unix socket with port $PGPORT)"
|
port_info="default port"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$PGHOST" ]; then
|
||||||
|
echo "(using postmaster on $PGHOST, $port_info)"
|
||||||
|
else
|
||||||
|
echo "(using postmaster on Unix socket, $port_info)"
|
||||||
fi
|
fi
|
||||||
message "dropping database \"$dbname\""
|
message "dropping database \"$dbname\""
|
||||||
"$bindir/dropdb" -p "$PGPORT" $psql_options "$dbname" >/dev/null 2>&1
|
"$bindir/dropdb" $psql_options "$dbname" >/dev/null 2>&1
|
||||||
# errors can be ignored
|
# errors can be ignored
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -348,7 +362,7 @@ fi
|
|||||||
# Set up SQL shell for the test.
|
# Set up SQL shell for the test.
|
||||||
# ----------
|
# ----------
|
||||||
|
|
||||||
PSQL="$bindir/psql -a -q -X $psql_options -p $PGPORT"
|
PSQL="$bindir/psql -a -q -X $psql_options"
|
||||||
|
|
||||||
|
|
||||||
# ----------
|
# ----------
|
||||||
@ -377,7 +391,7 @@ fi
|
|||||||
# ----------
|
# ----------
|
||||||
|
|
||||||
message "creating database \"$dbname\""
|
message "creating database \"$dbname\""
|
||||||
"$bindir/createdb" -p "$PGPORT" $encoding_opt $psql_options "$dbname"
|
"$bindir/createdb" $encoding_opt $psql_options "$dbname"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "$me: createdb failed"
|
echo "$me: createdb failed"
|
||||||
(exit 2); exit
|
(exit 2); exit
|
||||||
@ -392,7 +406,7 @@ case $host_platform in
|
|||||||
*-*-qnx*) : ;;
|
*-*-qnx*) : ;;
|
||||||
*)
|
*)
|
||||||
message "installing PL/pgSQL"
|
message "installing PL/pgSQL"
|
||||||
"$bindir/createlang" -p "$PGPORT" -L "$libdir" $psql_options plpgsql $dbname
|
"$bindir/createlang" -L "$libdir" $psql_options plpgsql $dbname
|
||||||
if [ $? -ne 0 ] && [ $? -ne 2 ]; then
|
if [ $? -ne 0 ] && [ $? -ne 2 ]; then
|
||||||
echo "$me: createlang failed"
|
echo "$me: createlang failed"
|
||||||
(exit 2); exit
|
(exit 2); exit
|
||||||
|
Loading…
x
Reference in New Issue
Block a user