--- a/contrib/pg_upgrade/test.sh
+++ b/contrib/pg_upgrade/test.sh
@@ -145,7 +145,7 @@ createdb "$dbname1" || createdb_status=$
 createdb "$dbname2" || createdb_status=$?
 createdb "$dbname3" || createdb_status=$?
 
-if "$MAKE" -C "$oldsrc" installcheck; then
+if "$MAKE" -C "$oldsrc" installcheck PSQLDIR=$bindir; then
 	pg_dumpall -f "$temp_root"/dump1.sql || pg_dumpall1_status=$?
 	if [ "$newsrc" != "$oldsrc" ]; then
 		oldpgversion=`psql -A -t -d regression -c "SHOW server_version_num"`
--- a/contrib/pg_upgrade/Makefile
+++ b/contrib/pg_upgrade/Makefile
@@ -1,5 +1,8 @@
 # contrib/pg_upgrade/Makefile
 
+MAKEOVERRIDES := $(filter-out EXTRA_REGRESS_OPTS=%,$(MAKEOVERRIDES))
+unexport EXTRA_REGRESS_OPTS
+
 PGFILEDESC = "pg_upgrade - an in-place binary upgrade utility"
 PGAPPICON = win32
 
