python / python/cpython

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

未关闭
#151,001 2 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

build type-bug
主要语言
Python
星标
77.2k
派生
35.9k
PR 合并指标
PR 指标待抓取

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 Makefile.pre.in 中的 coverage-lcov 目标开始,检查报告中显示的 lcov 和 genhtml 命令。使用 lcov 2.x 运行 make coverage-lcov,然后验证在没有报告中的选项错误和一致性错误的情况下生成覆盖率数据和 HTML 报告。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
build-system, testing-qa
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。