The attached patch is what I had to do to get pg_upgrade's "make check" to run on Windows under Mingw. Mostly the changes have to do with getting paths right between Windows and MSys, or calling generated .bat files instead of shell scripts.

cheers

andrew
diff --git a/contrib/pg_upgrade/test.sh b/contrib/pg_upgrade/test.sh
index 31e30af..fc2304a 100644
--- a/contrib/pg_upgrade/test.sh
+++ b/contrib/pg_upgrade/test.sh
@@ -43,13 +43,23 @@ if [ "$1" = '--install' ]; then
 	export EXTRA_REGRESS_OPTS
 fi
 
-: ${oldbindir=$bindir}
-
 : ${oldsrc=../..}
-oldsrc=`cd "$oldsrc" && pwd`
-newsrc=`cd ../.. && pwd`
 
-PATH=$bindir:$PATH
+if [ `uname -a | sed 's/.* //'` = Msys ] ; then
+	cp $libdir/libpq.dll $bindir
+	osbindir=`cd $bindir && pwd`
+	bindir=`cd $bindir && pwd -W`
+	oldsrc=`cd "$oldsrc" && pwd -W`
+	newsrc=`cd ../.. && pwd -W`
+else
+	osbindir=$bindir
+	oldsrc=`cd "$oldsrc" && pwd`
+	newsrc=`cd ../.. && pwd`
+fi
+
+: ${oldbindir=$bindir}
+
+PATH=$osbindir:$PATH
 export PATH
 
 PGDATA=$temp_root/data
@@ -104,10 +114,19 @@ mv "${PGDATA}" "${PGDATA}.old"
 
 initdb
 
+if [ `uname -a | sed 's/.* //'` = Msys ] ; then 
+	PGDATA=`cd $PGDATA && pwd -W`
+fi
+
 pg_upgrade -d "${PGDATA}.old" -D "${PGDATA}" -b "$oldbindir" -B "$bindir"
 
 pg_ctl start -l "$logdir/postmaster2.log" -w
-sh ./analyze_new_cluster.sh
+
+if  [ `uname -a | sed 's/.* //'` = Msys ] ; then
+	cmd /c analyze_new_cluster.bat
+else
+	sh ./analyze_new_cluster.sh
+fi
 pg_dumpall >"$temp_root"/dump2.sql || pg_dumpall2_status=$?
 pg_ctl -m fast stop
 if [ -n "$pg_dumpall2_status" ]; then
@@ -115,7 +134,15 @@ if [ -n "$pg_dumpall2_status" ]; then
 	exit 1
 fi
 
-sh ./delete_old_cluster.sh
+if  [ `uname -a | sed 's/.* //'` = Msys ] ; then
+	sed -i -e 's,/,\\,g' -e 's,\\s\\q ,/s/q ,' delete_old_cluster.bat 2>/dev/null
+	chmod +w delete_old_cluster.bat
+	cmd /c delete_old_cluster.bat
+	dos2unix "$temp_root"/dump1.sql >/dev/null
+	dos2unix "$temp_root"/dump2.sql >/dev/null
+else
+	sh ./delete_old_cluster.sh
+fi
 
 if diff -q "$temp_root"/dump1.sql "$temp_root"/dump2.sql; then
 	echo PASSED
-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to