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
7575 --temp-config=$(top_srcdir ) /$(subdir ) /conf.add \
7676 --outputdir=./isolation_output \
7777 $(ISOLATIONCHECKS )
78- partitioning_tests :
78+
79+ python_tests :
7980 $(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
22TOP_SRC_DIR = ../../src
33
44CC = 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)
66CFLAGS += -I$(CURDIR ) /../../src/include
77CFLAGS += $(shell $(PG_CONFIG ) --cflags_sl)
88CFLAGS += $(shell $(PG_CONFIG ) --cflags)
9+ CFLAGS += $(CFLAGS_SL )
910LDFLAGS = -lcmocka
1011TEST_BIN = rangeset_tests
1112
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 ||
8888# show diff if it exists
8989if test -f regression.diffs; then cat regression.diffs; fi
9090
91+
9192set +u
9293
93- # create a virtual environment and activate it
94+ # create virtual environment and activate it
9495virtualenv /tmp/envs/pg_pathman
9596source /tmp/envs/pg_pathman/bin/activate
9697
9798# install pip packages
9899pip3 install $pip_packages
99100
100101# 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
102106
103107set -u
104108
105109
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+
106134# generate *.gcov files
107135gcov src/* .c src/compat/* .c src/include/* .h src/include/compat/* .h
108136
You can’t perform that action at this time.
0 commit comments