生成lcov的分支覆盖数据 [英] generating branch coverage data for lcov
本文介绍了生成lcov的分支覆盖数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用lcov代码覆盖率指标,但我不能得到分支覆盖率。
g ++ -ggdb3 --coverage src / read.c tests / test.cpp -o bin / test
lcov --zerocounters --directory $ PWD
lcov --capture --initial --directory $ PWD --output-file coverage_output
./bin/test
lcov --no-checksum --directory $ PWD --capture --output-file coverage_output
genhtml --branch-coverage --highlight --legend --output-directory out coverage_output
但我得到:
总体覆盖率:
......:100.0%(60行中的60行)
函数..:100.0%(26个函数中的26个)
branches ...:未找到数据
任何想法?
解决方案
最新版本的lcov默认禁用分支覆盖。
您需要通过以下方式重新启用它:
- 编辑.lcovrc文件(从/ etc / lcovrc复制)以将lcov_branch_coverage设置更改为1
- 将lrc lcov_branch_coverage = 1添加到lcov命令行
i'm trying to use lcov for code coverage metrics, but I cannot get branches coverage to work.
Here's how i'm using it:
g++ -ggdb3 --coverage src/read.c tests/test.cpp -o bin/test
lcov --zerocounters --directory $PWD
lcov --capture --initial --directory $PWD --output-file coverage_output
./bin/test
lcov --no-checksum --directory $PWD --capture --output-file coverage_output
genhtml --branch-coverage --highlight --legend --output-directory out coverage_output
but i get:
Overall coverage rate:
lines......: 100.0% (60 of 60 lines)
functions..: 100.0% (26 of 26 functions)
branches...: no data found
any ideas?
解决方案
The latest version of lcov disabled branch coverage by default.
You need to re-enable it by either:
- editing your .lcovrc file (copied from /etc/lcovrc) to change lcov_branch_coverage setting to 1
- adding --rc lcov_branch_coverage=1 to your lcov command lines
这篇关于生成lcov的分支覆盖数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文