On tor, 2011-04-07 at 23:02 +0300, Peter Eisentraut wrote: > 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.)
Now that this is bound to be fixed, here is an updated script that runs the entire test procedure including diffing the dumps at the end.
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..bfbbb1c 100644 --- i/contrib/pg_upgrade/test.sh +++ w/contrib/pg_upgrade/test.sh @@ -0,0 +1,43 @@ +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 -rf "$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/postmaster1.log" -w +$MAKE -C ../.. installcheck 2>&1 | tee "$logdir/installcheck.log" +pg_dumpall >"$temp_root"/dump1.sql +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" + +pg_ctl start -l "$logdir/postmaster2.log" -w +pg_dumpall >"$temp_root"/dump2.sql +pg_ctl -m fast stop + +diff -q "$temp_root"/dump1.sql "$temp_root"/dump2.sql
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers