python / python/cpython

"make coverage-lcov" doesn't work with lcov v2.x

Open
#151,001 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

build type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Bug report

Bug description:

The Python Developer’s Guide says:

In order to create a HTML report you can install lcov.

Unfortunately, this doesn't work with a modern version of the lcov: e.g. first I got error about missing --path option. It "works for me" (with some warnings) on the patch:

diff --git a/Makefile.pre.in b/Makefile.pre.in
index 2b34b009fd7..20b895d488a 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -917,7 +917,6 @@ coverage-lcov:
        @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.
@@ -931,8 +930,11 @@ coverage-lcov:
            '/usr/include/*' \
            '/usr/local/include/*' \
            '/usr/lib/gcc/*' \
+               --ignore-errors inconsistent \
+               --ignore-errors unused \
            --output-file $(COVERAGE_INFO)
        @genhtml $(COVERAGE_INFO) \
+               --ignore-errors inconsistent \
            --output-directory $(COVERAGE_REPORT) \
            $(COVERAGE_REPORT_OPTIONS)
        @echo
CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs
  • gh-151008

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Makefile.pre.in at the coverage-lcov target and review the lcov and genhtml commands shown in the report. Run make coverage-lcov with lcov 2.x, then verify that coverage data and the HTML report are generated without the reported option and consistency errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.