@@ -13,6 +13,8 @@ pip_packages="testgres"
1313status=0
1414
1515# pg_config path
16+ pg_ctl_path=/usr/lib/postgresql/$PGVERSION /bin/pg_ctl
17+ initdb_path=/usr/lib/postgresql/$PGVERSION /bin/initdb
1618config_path=/usr/lib/postgresql/$PGVERSION /bin/pg_config
1719
1820
@@ -29,7 +31,9 @@ sudo chmod a+x /etc/init.d/postgresql
2931sudo apt-get -o Dpkg::Options::=" --force-confdef" -o Dpkg::Options::=" --force-confold" -y install -qq $apt_packages
3032
3133# create cluster 'test'
32- sudo pg_createcluster --start $PGVERSION test -p 55435 -- -A trust
34+ CLUSTER_PATH=$( pwd) /test_cluster
35+ $initdb_path -D $CLUSTER_PATH -U $USER -A trust
36+
3337
3438# perform code analysis if necessary
3539if [ $CHECK_CODE = " true" ]; then
@@ -61,16 +65,24 @@ if [ $CHECK_CODE = "true" ]; then
6165 make clean USE_PGXS=1 PG_CONFIG=$config_path
6266fi
6367
64- # build pg_pathman
65- make USE_PGXS=1 PG_CONFIG=$config_path
68+ # build pg_pathman (using CFLAGS_SL for gcov)
69+ make USE_PGXS=1 PG_CONFIG=$config_path CFLAGS_SL= " $( $config_path --cflags_sl ) -coverage "
6670sudo make install USE_PGXS=1 PG_CONFIG=$config_path
6771
72+ # set permission to write postgres locks
73+ sudo chown $USER /var/run/postgresql/
74+
75+ # check build
76+ status=$?
77+ if [ $status -ne 0 ]; then exit $status ; fi
78+
6879# add pg_pathman to shared_preload_libraries and restart cluster 'test'
69- sudo bash -c " echo \" shared_preload_libraries = 'pg_pathman'\" >> /etc/postgresql/$PGVERSION /test/postgresql.conf"
70- sudo pg_ctlcluster $PGVERSION test restart
80+ echo " shared_preload_libraries = 'pg_pathman'" >> $CLUSTER_PATH /postgresql.conf
81+ echo " port = 55435" >> $CLUSTER_PATH /postgresql.conf
82+ $pg_ctl_path -D $CLUSTER_PATH start -l postgres.log -w
7183
7284# run regression tests
73- PGPORT=55435 make installcheck USE_PGXS=1 PGUSER=postgres PG_CONFIG=$config_path || status=$?
85+ PGPORT=55435 PGUSER=$USER PG_CONFIG=$config_path make installcheck USE_PGXS=1 || status=$?
7486
7587# show diff if it exists
7688if test -f regression.diffs; then cat regression.diffs; fi
@@ -84,13 +96,16 @@ source /tmp/envs/pg_pathman/bin/activate
8496# install pip packages
8597pip install $pip_packages
8698
87- # set permission to write postgres locks
88- sudo chmod a+w /var/run/postgresql/
89-
9099# run python tests
91100cd tests/python
92101PG_CONFIG=$config_path python -m unittest partitioning_test || status=$?
102+ cd ../..
93103
94104set -u
95105
106+
107+ # generate *.gcov files
108+ gcov src/* .c src/* .h
109+
110+
96111exit $status
0 commit comments