@@ -20,22 +20,45 @@ if [ $CHECK_TYPE = "valgrind" ]; then
20
20
# install required packages
21
21
apt_packages=" build-essential libgd-dev valgrind lcov"
22
22
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
+
30
26
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
34
42
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
+
37
59
popd
38
- export PATH=" $prefix /bin:$PATH "
60
+ set +e
61
+ prefix=$CUSTOM_PG_BIN
39
62
else
40
63
apt_packages=" postgresql-$PG_VER postgresql-server-dev-$PG_VER postgresql-common build-essential libgd-dev"
41
64
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
116
139
if [ $CHECK_TYPE = " valgrind" ]; then
117
140
PGCTLTIMEOUT=600 \
118
141
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 \
120
143
--log-file=/tmp/pid-%p.log --trace-children=yes \
121
144
$pg_ctl_path -D $CLUSTER_PATH start -l postgres.log -w
122
145
else
0 commit comments