Skip to content

Instantly share code, notes, and snippets.

@jasonmp85
Forked from petere/pg-travis-test.sh
Last active August 29, 2015 13:57
Show Gist options
  • Save jasonmp85/9535149 to your computer and use it in GitHub Desktop.
Save jasonmp85/9535149 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -eux
sudo apt-get update
packages="postgresql-$PGVERSION postgresql-server-dev-$PGVERSION postgresql-common"
# bug: http://www.postgresql.org/message-id/[email protected]
sudo update-alternatives --remove-all postmaster.1.gz
# stop all existing instances (because of https://github.com/travis-ci/travis-cookbooks/pull/221)
sudo service postgresql stop
# and make sure they don't come back
echo 'exit 0' | sudo tee /etc/init.d/postgresql
sudo chmod a+x /etc/init.d/postgresql
sudo apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install $packages
status=0
sudo pg_createcluster $PGVERSION test -p 55435 -- -A trust
make all PG_CONFIG=/usr/lib/postgresql/$PGVERSION/bin/pg_config
sudo make install PG_CONFIG=/usr/lib/postgresql/$PGVERSION/bin/pg_config
echo "shared_preload_libraries = '$PG_PRELOAD'" | sudo tee -a /etc/postgresql/$PGVERSION/test/postgresql.conf
sudo pg_ctlcluster $PGVERSION test start
PGPORT=55435 make installcheck PGUSER=postgres PG_CONFIG=/usr/lib/postgresql/$PGVERSION/bin/pg_config || status=$?
if test -f regression.diffs; then cat regression.diffs; fi
exit $status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment