已合并
fix(cov): 加强cpp覆盖率脚本以适配lcov版本差异并容忍空数据 #966
liu-wei创建于 6月10日
fix(cov): 加强cpp覆盖率脚本以适配lcov版本差异并容忍空数据 #966
已合并
Pull Request已成功合入, 合并人@CANN-robot
(感谢 liu-wei 的贡献)6月10日 添加了label:cann-cla/yes
CANN-robot
6月10日 评论:
6月10日 评论:
Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-cann/ops-cv | ✅ 王林木, 张磊 (2/2) | ✅ 王林木, 张磊 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
liu-wei, thanks for your pull request. All authors of the commits have signed the CLA. 👍


6月10日 修改了pull request 的描述
liu-wei
6月10日 评论:
6月10日 评论:
compile


6月10日 update merge request[project id: 7657293, iid: 966, commit_id: e0b17d25aaaefeaf62d198a1b35d96ff11d78cdf] virtual merging success
6月10日 update merge request[project id: 7657293, iid: 966, commit_id: e0b17d25aaaefeaf62d198a1b35d96ff11d78cdf] virtual merging success
6月10日 添加了label:ci-pipeline-running
CANN-robot
6月10日 评论:
6月10日 评论:
流水线任务触发成功
任务链接 [4ce597e191844a1b83303c28e5571a81][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_A5 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A5 | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Pre | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_A5_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A5_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910b | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910c | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_950 | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test | ✅ SUCCESS | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> | |
| API_Check | ✅ SUCCESS | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> |
[2026-06-10 14:19:26] CI执行结束


CANN-robot
6月10日 评论:
6月10日 评论:
流水线任务触发成功
任务链接 [a7e550d670f54217b6ff370feaa19254][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_checkpr | ✅ SUCCESS | ||
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_codestyle | ✅ SUCCESS | >>>>> | |
| codecheck_precommit | ✅ SUCCESS | >>>>> | >>>>> |
[2026-06-10 14:17:29] CI执行结束


6月10日 添加了label:api-check-pass
6月10日 删除了label:ci-pipeline-running
6月10日 添加了label:ci-pipeline-passed
6月11日 修改了pull request 的描述
6月11日 添加了label:approved
6月11日 添加了label:lgtm
6月11日 关闭了关联的issue
6月11日 合入了pull request
描述
scripts/util/generate_cpp_cov.sh在以下场景会出现问题,本 PR 集中修复:[[ "${version}" =~ ^2\. ]]正则判断版本号,对未来 lcov 3.x / 1.10 等版本不友好;
--ignore-errors参数在generate_coverage、filter_coverage、generate_html三处分别硬编码,重复且不一致。genhtml报错:当过滤后的覆盖率文件为空时genhtml仍会被调用,触发
ERROR: no records found错误,导致 CMake 目标失败。.gcda文件时(如未执行 UT 编译或跳过覆盖率),脚本仍会尝试
lcov --capture并失败。改动要点:
version_ge辅助函数,基于 major/minor 数值做版本比较,替代临时拼凑的
=~ ^2\.正则。--ignore-errors构造逻辑为两个函数:build_ignore_errors_opt:用于lcov --capturebuild_ignore_errors_remove_opt:用于lcov --remove/lcov --extractgenerate_html增加空文件保护:过滤后的coverage.info为空时仅记录日志,不再调用
genhtml。find ... -name "*.gcda"守卫:源目录无任何.gcda数据时直接
logging "No coverage data found",不再exit 1,让 CMake 流程能继续。行为变更(向上兼容):
DIR COV_FILE OUT_PATH [UT_TYPE] [OP_NAMES],向后兼容。exit 1,新版 graceful 退出。如果有上游流水线依赖旧退出码,需要相应调整。
关联的Issue
关联 Issue: #514(https://gitcode.com/cann/ops-cv/issues/514)
测试
文档更新
类型标签