Skip to content

Commit c0df98b

Browse files
committed
Fix travis tests
1 parent e54c230 commit c0df98b

File tree

2 files changed

+40
-15
lines changed

2 files changed

+40
-15
lines changed

.travis.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ env:
2020
global:
2121
- LLVM_VER=4.0
2222
matrix:
23+
- PG_VER=11 CHECK_TYPE=normal
24+
- PG_VER=11 CHECK_TYPE=static
2325
- PG_VER=10 CHECK_TYPE=normal
2426
- PG_VER=10 CHECK_TYPE=static
25-
- PG_VER=10 CHECK_TYPE=valgrind
27+
- PG_VER=10.5 CHECK_TYPE=valgrind
2628
- PG_VER=9.6 CHECK_TYPE=normal
2729
- PG_VER=9.6 CHECK_TYPE=static
2830
- PG_VER=9.5 CHECK_TYPE=normal

travis/pg-travis-test.sh

+37-14
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,45 @@ if [ $CHECK_TYPE = "valgrind" ]; then
2020
# install required packages
2121
apt_packages="build-essential libgd-dev valgrind lcov"
2222
sudo apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y install -qq $apt_packages
23-
# grab sources from github
24-
echo `curl -s -I 'https://api.github.com/repos/postgres/postgres/git/refs/tags'`
25-
tag=`curl -s 'https://api.github.com/repos/postgres/postgres/git/refs/tags' | jq -r '.[].ref' | sed 's/^refs\/tags\///' | grep "REL_*${PG_VER/./_}_" | tail -n 1`
26-
[[ -z "$tag" ]] && { echo "could not get branch name for release" ; exit 1; }
27-
prefix="$HOME/pgsql-$tag"
28-
curl "https://codeload.github.com/postgres/postgres/tar.gz/$tag" -o ~/$tag.tar.gz
29-
# build them with valgrind support
23+
24+
set -e
25+
3026
pushd ~
31-
tar -xzf "$tag.tar.gz"
32-
cd "postgres-$tag"
33-
./configure --enable-debug --enable-cassert --enable-coverage --prefix=$prefix
27+
CUSTOM_PG_BIN=$PWD/pg_bin
28+
CUSTOM_PG_SRC=$PWD/postgresql
29+
30+
curl "https://ftp.postgresql.org/pub/source/v$PG_VER/postgresql-$PG_VER.tar.bz2" -o postgresql.tar.bz2
31+
mkdir $CUSTOM_PG_SRC
32+
33+
tar \
34+
--extract \
35+
--file postgresql.tar.bz2 \
36+
--directory $CUSTOM_PG_SRC \
37+
--strip-components 1
38+
39+
cd $CUSTOM_PG_SRC
40+
41+
# enable Valgrind support
3442
sed -i.bak "s/\/* #define USE_VALGRIND *\//#define USE_VALGRIND/g" src/include/pg_config_manual.h
35-
make -sj4
36-
make -sj4 install
43+
44+
# enable additional options
45+
./configure \
46+
CFLAGS='-Og -ggdb3 -fno-omit-frame-pointer' \
47+
--enable-cassert \
48+
--enable-coverage \
49+
--prefix=$CUSTOM_PG_BIN \
50+
--quiet
51+
52+
# build & install PG
53+
time make -s -j4 && make -s install
54+
55+
# override default PostgreSQL instance
56+
export PATH=$CUSTOM_PG_BIN/bin:$PATH
57+
export LD_LIBRARY_PATH=$CUSTOM_PG_BIN/lib
58+
3759
popd
38-
export PATH="$prefix/bin:$PATH"
60+
set +e
61+
prefix=$CUSTOM_PG_BIN
3962
else
4063
apt_packages="postgresql-$PG_VER postgresql-server-dev-$PG_VER postgresql-common build-essential libgd-dev"
4164
sudo apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y install -qq $apt_packages
@@ -116,7 +139,7 @@ echo "port = 55435" >> $CLUSTER_PATH/postgresql.conf
116139
if [ $CHECK_TYPE = "valgrind" ]; then
117140
PGCTLTIMEOUT=600 \
118141
valgrind --leak-check=no --gen-suppressions=all \
119-
--suppressions=$HOME/postgres-$tag/src/tools/valgrind.supp --time-stamp=yes \
142+
--suppressions=$CUSTOM_PG_SRC/src/tools/valgrind.supp --time-stamp=yes \
120143
--log-file=/tmp/pid-%p.log --trace-children=yes \
121144
$pg_ctl_path -D $CLUSTER_PATH start -l postgres.log -w
122145
else

0 commit comments

Comments
 (0)