Skip to content

Commit f87ac08

Browse files
committed
pythongh-94759: Create LCOV report with branch coverage
- fixed issue linker flags, LIBS is not passed to BLDSHARED - include version and git commit in output - include "Includes" directory, headers now have inline functions
1 parent 47f50cb commit f87ac08

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
@@ -318,7 +318,8 @@ PROFILE_TASK= @PROFILE_TASK@
318318
# report files for gcov / lcov coverage report
319319
COVERAGE_INFO= $(abs_builddir)/coverage.info
320320
COVERAGE_REPORT=$(abs_builddir)/lcov-report
321-
COVERAGE_REPORT_OPTIONS=--no-branch-coverage --title "CPython lcov report"
321+
COVERAGE_LCOV_OPTIONS=--rc lcov_branch_coverage=1
322+
COVERAGE_REPORT_OPTIONS=--rc lcov_branch_coverage=1 --branch-coverage --title "CPython $(VERSION) LCOV report [commit $(shell $(GITVERSION))]"
322323

323324

324325
# === Definitions added by makesetup ===
@@ -651,33 +652,33 @@ profile-opt: profile-run-stamp
651652
coverage:
652653
@echo "Building with support for coverage checking:"
653654
$(MAKE) clean
654-
$(MAKE) @DEF_MAKE_RULE@ CFLAGS="$(CFLAGS) -O0 -pg --coverage" LIBS="$(LIBS) --coverage"
655+
$(MAKE) @DEF_MAKE_RULE@ CFLAGS="$(CFLAGS) -O0 -pg --coverage" LDFLAGS="$(LDFLAGS) --coverage"
655656

656657
coverage-lcov:
657658
@echo "Creating Coverage HTML report with LCOV:"
658659
@rm -f $(COVERAGE_INFO)
659660
@rm -rf $(COVERAGE_REPORT)
660-
@lcov --capture --directory $(abs_builddir) \
661+
@lcov $(COVERAGE_LCOV_OPTIONS) --capture \
662+
--directory $(abs_builddir) \
661663
--base-directory $(realpath $(abs_builddir)) \
662664
--path $(realpath $(abs_srcdir)) \
663665
--output-file $(COVERAGE_INFO)
664666
@ # remove 3rd party modules, system headers and internal files with
665667
@ # debug, test or dummy functions.
666-
@lcov --remove $(COVERAGE_INFO) \
668+
@lcov $(COVERAGE_LCOV_OPTIONS) --remove $(COVERAGE_INFO) \
667669
'*/Modules/_blake2/impl/*' \
668670
'*/Modules/_ctypes/libffi*/*' \
669671
'*/Modules/_decimal/libmpdec/*' \
670672
'*/Modules/expat/*' \
671-
'*/Modules/zlib/*' \
672-
'*/Include/*' \
673673
'*/Modules/xx*.c' \
674674
'*/Python/pyfpe.c' \
675675
'*/Python/pystrcmp.c' \
676676
'/usr/include/*' \
677677
'/usr/local/include/*' \
678678
'/usr/lib/gcc/*' \
679679
--output-file $(COVERAGE_INFO)
680-
@genhtml $(COVERAGE_INFO) --output-directory $(COVERAGE_REPORT) \
680+
@genhtml $(COVERAGE_INFO) \
681+
--output-directory $(COVERAGE_REPORT) \
681682
$(COVERAGE_REPORT_OPTIONS)
682683
@echo
683684
@echo "lcov report at $(COVERAGE_REPORT)/index.html"

0 commit comments

Comments
 (0)