Add valgrind to travis configuration and check for leaks

This commit is contained in:
Benedikt Heine 2017-12-19 11:20:38 +01:00
parent b9f347d80a
commit 1d39aa348c
3 changed files with 23 additions and 2 deletions

View File

@ -12,13 +12,14 @@ addons:
- libcairo2-dev
- libnotify-dev
- libgtk-3-dev
- valgrind
dist: trusty
sudo: false
language: c
before_install:
- pip install --user cpp-coveralls
script:
- CFLAGS="-fprofile-arcs -ftest-coverage -Werror" make all dunstify test
- CFLAGS="-fprofile-arcs -ftest-coverage -Werror" make all dunstify test-valgrind
- coveralls
compiler:
- gcc

10
.valgrind.suppressions Normal file
View File

@ -0,0 +1,10 @@
{
xdgBaseDir_leak
# see https://github.com/devnev/libxdg-basedir/pull/6
Memcheck:Leak
fun:malloc
...
fun:xdgInitHandle
...
fun:main
}

View File

@ -44,10 +44,20 @@ dunst: ${OBJ} main.o
dunstify: dunstify.o
${CC} ${CFLAGS} -o $@ dunstify.o ${LDFLAGS}
.PHONY: test
.PHONY: test test-valgrind
test: test/test
cd test && ./test
test-valgrind: test/test
cd ./test \
&& valgrind \
--suppressions=../.valgrind.suppressions \
--leak-check=full \
--show-leak-kinds=definite \
--errors-for-leak-kinds=definite \
--error-exitcode=123 \
./test
test/test: ${OBJ} ${TEST_OBJ}
${CC} ${CFLAGS} -o $@ ${TEST_OBJ} ${OBJ} ${LDFLAGS}