Makefile: add lcov command
authorJoe Guo <joeg@catalyst.net.nz>
Thu, 16 May 2019 02:38:25 +0000 (14:38 +1200)
committerGary Lockyer <gary@samba.org>
Wed, 22 May 2019 05:59:13 +0000 (05:59 +0000)
A helper cmd to generate .info file from .gcno and .gcda file,
and then generate html report from .info file.

Usage:

./configure --enable-coverage
make -j
make test TESTS=mytest
make lcov

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Makefile

index d456a410050a7fa6e6612ca9d0e6d7075785d9d2..07b928e4f0117cc8306ec6b5179931c26a806156 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -28,6 +28,19 @@ subunit-test:
 testenv:
        $(WAF) test --testenv $(TEST_OPTIONS)
 
+lcov:
+       @echo usage:
+       @echo ""
+       @echo ./configure --enable-coverage
+       @echo make -j
+       @echo make test TESTS=mytest
+       @echo make lcov
+       @echo ""
+       rm -f lcov.info
+       lcov --capture --directory . --output-file lcov.info && \
+       genhtml lcov.info --output-directory public --prefix=$$(pwd) && \
+       echo Please open public/index.html in browser to view the coverage report
+
 gdbtestenv:
        $(WAF) test --testenv --gdbtest $(TEST_OPTIONS)