Skip to content

Commit

Permalink
pythongh-94759: Create LCOV report with branch coverage (pythonGH-94793)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiran authored Jul 13, 2022
1 parent fc21a43 commit f5c02af
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ PROFILE_TASK= @PROFILE_TASK@
# report files for gcov / lcov coverage report
COVERAGE_INFO= $(abs_builddir)/coverage.info
COVERAGE_REPORT=$(abs_builddir)/lcov-report
COVERAGE_REPORT_OPTIONS=--no-branch-coverage --title "CPython lcov report"
COVERAGE_LCOV_OPTIONS=--rc lcov_branch_coverage=1
COVERAGE_REPORT_OPTIONS=--rc lcov_branch_coverage=1 --branch-coverage --title "CPython $(VERSION) LCOV report [commit $(shell $(GITVERSION))]"


# === Definitions added by makesetup ===
Expand Down Expand Up @@ -651,33 +652,33 @@ profile-opt: profile-run-stamp
coverage:
@echo "Building with support for coverage checking:"
$(MAKE) clean
$(MAKE) @DEF_MAKE_RULE@ CFLAGS="$(CFLAGS) -O0 -pg --coverage" LIBS="$(LIBS) --coverage"
$(MAKE) @DEF_MAKE_RULE@ CFLAGS="$(CFLAGS) -O0 -pg --coverage" LDFLAGS="$(LDFLAGS) --coverage"

coverage-lcov:
@echo "Creating Coverage HTML report with LCOV:"
@rm -f $(COVERAGE_INFO)
@rm -rf $(COVERAGE_REPORT)
@lcov --capture --directory $(abs_builddir) \
@lcov $(COVERAGE_LCOV_OPTIONS) --capture \
--directory $(abs_builddir) \
--base-directory $(realpath $(abs_builddir)) \
--path $(realpath $(abs_srcdir)) \
--output-file $(COVERAGE_INFO)
@ # remove 3rd party modules, system headers and internal files with
@ # debug, test or dummy functions.
@lcov --remove $(COVERAGE_INFO) \
@lcov $(COVERAGE_LCOV_OPTIONS) --remove $(COVERAGE_INFO) \
'*/Modules/_blake2/impl/*' \
'*/Modules/_ctypes/libffi*/*' \
'*/Modules/_decimal/libmpdec/*' \
'*/Modules/expat/*' \
'*/Modules/zlib/*' \
'*/Include/*' \
'*/Modules/xx*.c' \
'*/Python/pyfpe.c' \
'*/Python/pystrcmp.c' \
'/usr/include/*' \
'/usr/local/include/*' \
'/usr/lib/gcc/*' \
--output-file $(COVERAGE_INFO)
@genhtml $(COVERAGE_INFO) --output-directory $(COVERAGE_REPORT) \
@genhtml $(COVERAGE_INFO) \
--output-directory $(COVERAGE_REPORT) \
$(COVERAGE_REPORT_OPTIONS)
@echo
@echo "lcov report at $(COVERAGE_REPORT)/index.html"
Expand Down

0 comments on commit f5c02af

Please sign in to comment.