@@ -13,6 +13,8 @@ pip_packages="testgres"
13
13
status=0
14
14
15
15
# pg_config path
16
+ pg_ctl_path=/usr/lib/postgresql/$PGVERSION /bin/pg_ctl
17
+ initdb_path=/usr/lib/postgresql/$PGVERSION /bin/initdb
16
18
config_path=/usr/lib/postgresql/$PGVERSION /bin/pg_config
17
19
18
20
@@ -29,7 +31,9 @@ sudo chmod a+x /etc/init.d/postgresql
29
31
sudo apt-get -o Dpkg::Options::=" --force-confdef" -o Dpkg::Options::=" --force-confold" -y install -qq $apt_packages
30
32
31
33
# 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
+
33
37
34
38
# perform code analysis if necessary
35
39
if [ $CHECK_CODE = " true" ]; then
@@ -61,16 +65,24 @@ if [ $CHECK_CODE = "true" ]; then
61
65
make clean USE_PGXS=1 PG_CONFIG=$config_path
62
66
fi
63
67
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 "
66
70
sudo make install USE_PGXS=1 PG_CONFIG=$config_path
67
71
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
+
68
79
# 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
71
83
72
84
# 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=$?
74
86
75
87
# show diff if it exists
76
88
if test -f regression.diffs; then cat regression.diffs; fi
@@ -84,13 +96,16 @@ source /tmp/envs/pg_pathman/bin/activate
84
96
# install pip packages
85
97
pip install $pip_packages
86
98
87
- # set permission to write postgres locks
88
- sudo chmod a+w /var/run/postgresql/
89
-
90
99
# run python tests
91
100
cd tests/python
92
101
PG_CONFIG=$config_path python -m unittest partitioning_test || status=$?
102
+ cd ../..
93
103
94
104
set -u
95
105
106
+
107
+ # generate *.gcov files
108
+ gcov src/* .c src/* .h
109
+
110
+
96
111
exit $status
0 commit comments