Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 556f685

Browse files
tiranmiss-islington
authored andcommittedJul 13, 2022
pythongh-94759: Create LCOV report with branch coverage (pythonGH-94793)
(cherry picked from commit f5c02af) Co-authored-by: Christian Heimes <christian@python.org>
1 parent ffbd6ae commit 556f685

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed
 

‎Makefile.pre.in

+8-7
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,8 @@ PROFILE_TASK= @PROFILE_TASK@
316316
# report files for gcov / lcov coverage report
317317
COVERAGE_INFO= $(abs_builddir)/coverage.info
318318
COVERAGE_REPORT=$(abs_builddir)/lcov-report
319-
COVERAGE_REPORT_OPTIONS=--no-branch-coverage --title "CPython lcov report"
319+
COVERAGE_LCOV_OPTIONS=--rc lcov_branch_coverage=1
320+
COVERAGE_REPORT_OPTIONS=--rc lcov_branch_coverage=1 --branch-coverage --title "CPython $(VERSION) LCOV report [commit $(shell $(GITVERSION))]"
320321

321322

322323
# === Definitions added by makesetup ===
@@ -653,33 +654,33 @@ profile-opt: profile-run-stamp
653654
coverage:
654655
@echo "Building with support for coverage checking:"
655656
$(MAKE) clean
656-
$(MAKE) @DEF_MAKE_RULE@ CFLAGS="$(CFLAGS) -O0 -pg --coverage" LIBS="$(LIBS) --coverage"
657+
$(MAKE) @DEF_MAKE_RULE@ CFLAGS="$(CFLAGS) -O0 -pg --coverage" LDFLAGS="$(LDFLAGS) --coverage"
657658

658659
coverage-lcov:
659660
@echo "Creating Coverage HTML report with LCOV:"
660661
@rm -f $(COVERAGE_INFO)
661662
@rm -rf $(COVERAGE_REPORT)
662-
@lcov --capture --directory $(abs_builddir) \
663+
@lcov $(COVERAGE_LCOV_OPTIONS) --capture \
664+
--directory $(abs_builddir) \
663665
--base-directory $(realpath $(abs_builddir)) \
664666
--path $(realpath $(abs_srcdir)) \
665667
--output-file $(COVERAGE_INFO)
666668
@ # remove 3rd party modules, system headers and internal files with
667669
@ # debug, test or dummy functions.
668-
@lcov --remove $(COVERAGE_INFO) \
670+
@lcov $(COVERAGE_LCOV_OPTIONS) --remove $(COVERAGE_INFO) \
669671
'*/Modules/_blake2/impl/*' \
670672
'*/Modules/_ctypes/libffi*/*' \
671673
'*/Modules/_decimal/libmpdec/*' \
672674
'*/Modules/expat/*' \
673-
'*/Modules/zlib/*' \
674-
'*/Include/*' \
675675
'*/Modules/xx*.c' \
676676
'*/Python/pyfpe.c' \
677677
'*/Python/pystrcmp.c' \
678678
'/usr/include/*' \
679679
'/usr/local/include/*' \
680680
'/usr/lib/gcc/*' \
681681
--output-file $(COVERAGE_INFO)
682-
@genhtml $(COVERAGE_INFO) --output-directory $(COVERAGE_REPORT) \
682+
@genhtml $(COVERAGE_INFO) \
683+
--output-directory $(COVERAGE_REPORT) \
683684
$(COVERAGE_REPORT_OPTIONS)
684685
@echo
685686
@echo "lcov report at $(COVERAGE_REPORT)/index.html"

0 commit comments

Comments
 (0)
Please sign in to comment.