Move test coverage generation into Makefile
Add the necessary compiler flags to the Makefile to actually make coverage reports available locally, too. The coverage files have to get cleaned every time before the test gets run. Otherwise, it would sum up the coverage over multiple test runs.
This commit is contained in:
parent
eba6913faa
commit
b4ce81b1c9
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,5 +1,8 @@
|
||||
dunst
|
||||
*.o
|
||||
*.gcda
|
||||
*.gcno
|
||||
*.gcov
|
||||
core
|
||||
vgcore.*
|
||||
dunst.1
|
||||
|
@ -26,8 +26,8 @@ before_install:
|
||||
|
||||
script:
|
||||
- CFLAGS="-Werror" make all dunstify test-valgrind doc-doxygen
|
||||
- make clean
|
||||
- CFLAGS="-Werror -fprofile-arcs -ftest-coverage -O0" make test
|
||||
- CFLAGS="-Werror" make clean
|
||||
- CFLAGS="-Werror" make test-coverage
|
||||
|
||||
matrix:
|
||||
include:
|
||||
|
19
Makefile
19
Makefile
@ -69,8 +69,8 @@ dunst: ${OBJ} main.o
|
||||
dunstify: dunstify.o
|
||||
${CC} -o ${@} dunstify.o ${CFLAGS} ${LDFLAGS}
|
||||
|
||||
.PHONY: test test-valgrind
|
||||
test: test/test
|
||||
.PHONY: test test-valgrind test-coverage
|
||||
test: test/test clean-coverage-run
|
||||
cd test && ./test
|
||||
|
||||
test-valgrind: test/test
|
||||
@ -84,6 +84,9 @@ test-valgrind: test/test
|
||||
--error-exitcode=123 \
|
||||
./test
|
||||
|
||||
test-coverage: CFLAGS += -fprofile-arcs -ftest-coverage -O0
|
||||
test-coverage: test
|
||||
|
||||
test/test: ${OBJ} ${TEST_OBJ}
|
||||
${CC} -o ${@} ${TEST_OBJ} ${OBJ} ${CFLAGS} ${LDFLAGS}
|
||||
|
||||
@ -104,8 +107,8 @@ service-systemd:
|
||||
@sed "s|##PREFIX##|$(PREFIX)|" dunst.systemd.service.in > dunst.systemd.service
|
||||
endif
|
||||
|
||||
.PHONY: clean clean-dunst clean-dunstify clean-doc clean-tests
|
||||
clean: clean-dunst clean-dunstify clean-doc clean-tests
|
||||
.PHONY: clean clean-dunst clean-dunstify clean-doc clean-tests clean-coverage clean-coverage-run
|
||||
clean: clean-dunst clean-dunstify clean-doc clean-tests clean-coverage clean-coverage-run
|
||||
|
||||
clean-dunst:
|
||||
rm -f dunst ${OBJ} main.o
|
||||
@ -123,6 +126,14 @@ clean-doc:
|
||||
clean-tests:
|
||||
rm -f test/test test/*.o
|
||||
|
||||
clean-coverage: clean-coverage-run
|
||||
find . -type f -name '*.gcno' -delete
|
||||
find . -type f -name '*.gcna' -delete
|
||||
# Cleans the coverage data before every run to not double count any lines
|
||||
clean-coverage-run:
|
||||
find . -type f -name '*.gcov' -delete
|
||||
find . -type f -name '*.gcda' -delete
|
||||
|
||||
.PHONY: install install-dunst install-doc \
|
||||
install-service install-service-dbus install-service-systemd \
|
||||
uninstall \
|
||||
|
Loading…
x
Reference in New Issue
Block a user