diff options
author | Kevin Murray <spam@kdmurray.id.au> | 2014-07-09 18:37:32 +1000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-07-16 05:54:34 -0400 |
commit | 8fa845548bc2883c6b1335b4815fa945964f517f (patch) | |
tree | b47936d8c595e08f469eee474ae9d061da3e3001 /Makefile.am | |
parent | 3f683aadcd03c311c1d987ab847a77dbe3fb2bf1 (diff) | |
download | tor-8fa845548bc2883c6b1335b4815fa945964f517f.tar.gz tor-8fa845548bc2883c6b1335b4815fa945964f517f.zip |
Add coverage-html makefile target
This uses lcov to generate a nice HTML report of test code coverage,
including branch coverage.
Signed-off-by: Kevin Murray <spam@kdmurray.id.au>
Diffstat (limited to 'Makefile.am')
-rw-r--r-- | Makefile.am | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am index 6eceb761f4..ab0caf008a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -74,6 +74,17 @@ test-network: all reset-gcov: rm -f src/*/*.gcda +HTML_COVER_DIR=./coverage_html +coverage-html: all + test -d $(HTML_COVER_DIR) && rm -rf $(HTML_COVER_DIR) || true + test -e `which lcov` || (echo "lcov must be installed. See <http://ltp.sourceforge.net/coverage/lcov.php>." && false) + mkdir -p $(HTML_COVER_DIR) + lcov --rc lcov_branch_coverage=1 --directory ./src --zerocounters + ./src/test/test + lcov --capture --rc lcov_branch_coverage=1 --no-external --directory . --output-file "$(HTML_COVER_DIR)/lcov.tmp" + lcov --remove "$(HTML_COVER_DIR)/lcov.tmp" --rc lcov_branch_coverage=1 'test/*' 'ext/tinytest*' '/usr/*' --output-file "$(HTML_COVER_DIR)/lcov.info" + genhtml --branch-coverage -o "$(HTML_COVER_DIR)" "$(HTML_COVER_DIR)/lcov.info" + # Avoid strlcpy.c, strlcat.c, aes.c, OpenBSD_malloc_Linux.c, sha256.c, # eventdns.[hc], tinytest*.[ch] check-spaces: |