--- a/contrib/pg_upgrade/test.sh
+++ b/contrib/pg_upgrade/test.sh
@@ -22,7 +22,7 @@ case $testhost in
 	*)		LISTEN_ADDRESSES="" ;;
 esac
 
-POSTMASTER_OPTS="-F -c listen_addresses=$LISTEN_ADDRESSES"
+POSTMASTER_OPTS="-F -c listen_addresses=$LISTEN_ADDRESSES -c unix_socket_directory=/tmp"
 
 temp_root=$PWD/tmp_check
 
@@ -80,7 +80,7 @@ PGSERVICE="";         unset PGSERVICE
 PGSSLMODE="";         unset PGSSLMODE
 PGREQUIRESSL="";      unset PGREQUIRESSL
 PGCONNECT_TIMEOUT=""; unset PGCONNECT_TIMEOUT
-PGHOST="";            unset PGHOST
+export PGHOST="/tmp"
 PGHOSTADDR="";        unset PGHOSTADDR
 
 logdir=$PWD/log
