Seeing that 9.1-to-9.1 pg_upgrade has apparently been broken for months,
it would probably be good to have some kind of automatic testing for it.
Attached is something I hacked together that at least exposes the
current problems, easily available by typing "make check" and waiting.
It does not yet fully implement the full testing procedure in the
TESTING file, in particular the diffing of the dumps (well, because you
can't get there yet).

Is that something that people are interested in refining?

(I think it would even be possible under this setup to create special
regression test cases that are only run under the pg_upgrade test run,
to exercise particularly tricky upgrade cases.)

diff --git i/contrib/pg_upgrade/Makefile w/contrib/pg_upgrade/Makefile
index 8f3fd7c..9ec7bc0 100644
--- i/contrib/pg_upgrade/Makefile
+++ w/contrib/pg_upgrade/Makefile
@@ -21,3 +21,6 @@ top_builddir = ../..
 include $(top_builddir)/src/Makefile.global
 include $(top_srcdir)/contrib/contrib-global.mk
 endif
+
+check: test.sh
+	MAKE=$(MAKE) bindir=$(bindir) $(SHELL) $<
diff --git i/contrib/pg_upgrade/test.sh w/contrib/pg_upgrade/test.sh
index e69de29..a0d459e 100644
--- i/contrib/pg_upgrade/test.sh
+++ w/contrib/pg_upgrade/test.sh
@@ -0,0 +1,36 @@
+set -eux
+
+: ${MAKE=make}
+temp_root=$PWD/tmp_check
+
+temp_install=$temp_root/install
+bindir=$temp_install/$bindir
+PATH=$bindir:$PATH
+export PATH
+
+PGDATA=$temp_root/data
+export PGDATA
+rm -rf "$PGDATA" "$PGDATA".old
+PGPORT=65432
+export PGPORT
+
+logdir=$PWD/log
+rm -r "$logdir"
+mkdir "$logdir"
+
+$MAKE -C ../.. install DESTDIR="$temp_install" 2>&1 | tee "$logdir/install.log"
+$MAKE -C ../pg_upgrade_support install DESTDIR="$temp_install" 2>&1 | tee -a "$logdir/install.log"
+$MAKE -C . install DESTDIR="$temp_install" 2>&1 | tee -a "$logdir/install.log"
+
+initdb 2>&1 | tee "$logdir/initdb1.log"
+pg_ctl start -l "$logdir/postmaster.log" -w
+$MAKE -C ../.. installcheck 2>&1 | tee "$logdir/installcheck.log"
+pg_ctl -m fast stop
+
+mv "${PGDATA}" "${PGDATA}.old"
+
+initdb 2>&1 | tee "$logdir/initdb2.log"
+
+unset PGPORT
+
+pg_upgrade -d "${PGDATA}.old" -D "${PGDATA}" -b "$bindir" -B "$bindir"
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to