Makefile: build python against libaubio to get all coverage
[aubio.git] / Makefile
index 37550c8..f8af602 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -36,7 +36,7 @@ DATAROOTDIR?=$(PREFIX)/share
 MANDIR?=$(DATAROOTDIR)/man
 
 # default nose2 command
-NOSE2?=nose2 -N 4
+NOSE2?=nose2 -N 4 --verbose
 
 SOX=sox
 
@@ -138,8 +138,8 @@ test_python: export LD_LIBRARY_PATH=$(DESTDIR)/$(LIBDIR)
 test_python: export PYTHONPATH=$(PYDESTDIR)/$(LIBDIR)
 test_python: local_dylib
        # run test with installed package
-       ./python/tests/run_all_tests --verbose
-       # also run with nose, multiple processes
+       ./python/tests/run_all_tests --verbose
+       # run with nose2, multiple processes
        $(NOSE2)
 
 clean_python:
@@ -234,6 +234,27 @@ test_python_only_clean: test_python_only \
        uninstall_python \
        check_clean_python
 
+coverage: export CFLAGS=--coverage
+coverage: export LDFLAGS=--coverage
+coverage: export PYTHONPATH=$(PWD)/python/lib
+coverage: export LD_LIBRARY_PATH=$(PWD)/build/src
+coverage: force_uninstall_python deps_python \
+       clean_python clean distclean build local_dylib
+       lcov --capture --no-external --directory . --output-file build/coverage_lib.info
+       pip install -v -e .
+       coverage run `which nose2`
+       lcov --capture --no-external --directory . --output-file build/coverage_python.info
+       lcov -a build/coverage_python.info -a build/coverage_lib.info -o build/coverage.info
+
+coverage_report: coverage
+       genhtml build/coverage.info --output-directory lcov_html
+       mkdir -p gcovr_html/
+       gcovr -r . --html --html-details \
+               --output gcovr_html/index.html \
+               --exclude ".*tests/.*" --exclude ".*examples/.*"
+       coverage report
+       coverage html
+
 sphinx: configure
        $(WAFCMD) sphinx $(WAFOPTS)