#! /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`
: ${TMPDIR=/tmp}
unset temp_install
unset multibyte
+export PGHOST
+export PGPORT
+
dbname=regression
hostname=`hostname` || hostname=localhost
unix_sockets=yes;;
esac
-[ "$unix_sockets" = no ] && psql_options="$psql_options -h $PGHOST"
-
# ----------
# Set up diff to ignore horizontal white space differences.
libdir=$temp_install/$libdir
datadir=$temp_install/$datadir
PGDATA=$temp_install/data
- PGHOST=$hostname
+ if [ "$unix_sockets" = no ]; then
+ PGHOST=$hostname
+ else
+ unset PGHOST
+ fi
PGPORT=65432
# ----------
message "starting postmaster"
[ "$debug" = yes ] && postmaster_options="$postmaster_options -d 5"
[ "$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=$!
if kill -0 $postmaster_pid >/dev/null 2>&1
else # not temp-install
+ # If Unix sockets are not available, use the local host by default.
+ [ "$unix_sockets" = no ] && ${PGHOST=$hostname}
+
+ if [ -n "$PGPORT" ]; then
+ port_info="port $PGPORT"
+ else
+ port_info="default port"
+ fi
+
if [ -n "$PGHOST" ]; then
- echo "(using postmaster on $PGHOST at port $PGPORT)"
+ echo "(using postmaster on $PGHOST, $port_info)"
else
- echo "(using postmaster on Unix socket with port $PGPORT)"
+ echo "(using postmaster on Unix socket, $port_info)"
fi
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
fi
# 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"
# ----------
# ----------
message "creating database \"$dbname\""
-"$bindir/createdb" -p "$PGPORT" $encoding_opt $psql_options "$dbname"
+"$bindir/createdb" $encoding_opt $psql_options "$dbname"
if [ $? -ne 0 ]; then
echo "$me: createdb failed"
(exit 2); exit
*-*-qnx*) : ;;
*)
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
echo "$me: createlang failed"
(exit 2); exit