File tree Expand file tree Collapse file tree 4 files changed +37
-4
lines changed Expand file tree Collapse file tree 4 files changed +37
-4
lines changed Original file line number Diff line number Diff line change @@ -75,5 +75,9 @@ isolationcheck: | submake-isolation
75
75
--temp-config=$(top_srcdir ) /$(subdir ) /conf.add \
76
76
--outputdir=./isolation_output \
77
77
$(ISOLATIONCHECKS )
78
- partitioning_tests :
78
+
79
+ python_tests :
79
80
$(MAKE ) -C tests/python partitioning_tests
81
+
82
+ cmocka_tests :
83
+ $(MAKE ) -C tests/cmocka check
Original file line number Diff line number Diff line change @@ -2,10 +2,11 @@ PG_CONFIG = pg_config
2
2
TOP_SRC_DIR = ../../src
3
3
4
4
CC = gcc
5
- CFLAGS = -I $(TOP_SRC_DIR ) -I $(shell $(PG_CONFIG ) --includedir-server)
5
+ CFLAGS + = -I $(TOP_SRC_DIR ) -I $(shell $(PG_CONFIG ) --includedir-server)
6
6
CFLAGS += -I$(CURDIR ) /../../src/include
7
7
CFLAGS += $(shell $(PG_CONFIG ) --cflags_sl)
8
8
CFLAGS += $(shell $(PG_CONFIG ) --cflags)
9
+ CFLAGS += $(CFLAGS_SL )
9
10
LDFLAGS = -lcmocka
10
11
TEST_BIN = rangeset_tests
11
12
Original file line number Diff line number Diff line change @@ -88,21 +88,49 @@ PGPORT=55435 PGUSER=$USER PG_CONFIG=$config_path make installcheck USE_PGXS=1 ||
88
88
# show diff if it exists
89
89
if test -f regression.diffs; then cat regression.diffs; fi
90
90
91
+
91
92
set +u
92
93
93
- # create a virtual environment and activate it
94
+ # create virtual environment and activate it
94
95
virtualenv /tmp/envs/pg_pathman
95
96
source /tmp/envs/pg_pathman/bin/activate
96
97
97
98
# install pip packages
98
99
pip3 install $pip_packages
99
100
100
101
# run python tests
101
- make USE_PGXS=1 PG_CONFIG=$config_path partitioning_tests || status=$?
102
+ make USE_PGXS=1 PG_CONFIG=$config_path python_tests || status=$?
103
+
104
+ # deactivate virtual environment
105
+ deactivate
102
106
103
107
set -u
104
108
105
109
110
+ # install cmake for cmocka
111
+ sudo apt-get -y install -qq cmake
112
+
113
+ # build & install cmocka
114
+ CMOCKA_VER=1.1.1
115
+ cd tests/cmocka
116
+ tar xf cmocka-$CMOCKA_VER .tar.xz
117
+ cd cmocka-$CMOCKA_VER
118
+ mkdir build && cd build
119
+ cmake ..
120
+ make && sudo make install
121
+ cd ../../../..
122
+
123
+ # export path to libcmocka.so
124
+ LD_LIBRARY_PATH=/usr/local/lib
125
+ export LD_LIBRARY_PATH
126
+
127
+ # run cmocka tests (using CFLAGS_SL for gcov)
128
+ make USE_PGXS=1 PG_CONFIG=$config_path CFLAGS_SL=" $( $config_path --cflags_sl) -coverage" cmocka_tests || status=$?
129
+
130
+ # remove useless gcov files
131
+ rm -f tests/cmocka/* .gcno
132
+ rm -f tests/cmocka/* .gcda
133
+
106
134
# generate *.gcov files
107
135
gcov src/* .c src/compat/* .c src/include/* .h src/include/compat/* .h
108
136
You can’t perform that action at this time.
0 commit comments