Lcov: can not collect branch coverage statistics

十年热恋 提交于 2019-12-06 16:48:53

问题


I used the lcov to create coverage information in my project. But I only can get line coverage and function coverage statistics information.

lcov version:1.10, gcov version:4.4.5

The commands I used is:

 lcov -d $OSPL_HOME/src -d $OSPL_OUTER_HOME/src  -c -o /work/li/log/lcov-raw.info

lcov -r /work/li/log/lcov-raw.info "*.ll" "*.yy" "*.yy.c" yaccpar "TAO161*" "/usr/include/*"  "*/testsuite/*" -o /work/li/log/lcov.info

After these two commands, I got the results is:

Deleted 23 files

Writing data to /work/li/log/lcov.info

Summary coverage rate:

  lines......: 45.4% (65087 of 143496 lines)

   functions..: 46.1% (5575 of 12102 functions)

  **branches...: no data found**

So there were no branches coverage results. Why? So what happened? And how can this happen? I am confused here.

After the first command, I got lots of warnings like these:

geninfo: WARNING: cannot find an entry for ..#..#code#accum.c.gcov in .gcno file, skipping file!
 geninfo: WARNING: cannot find an entry for ..#..#code#at.c.gcov in .gcno file, skipping file!
 geninfo: WARNING: cannot find an entry for ..#..#code#autodef.c.gcov in .gcno file, skipping file!
 geninfo: WARNING: cannot find an entry for ..#..#code#copyof.c.gcov in .gcno file, skipping file!
 geninfo: WARNING: cannot find an entry for ..#..#code#debug.c.gcov in .gcno file, skipping file!
 geninfo: WARNING: cannot find an entry for ..#..#code#define.c.gcov in .gcno file, skipping file!
 geninfo: WARNING: cannot find an entry for ..#..#code#dump.c.gcov in .gcno file,skipping file!
 geninfo: WARNING: cannot find an entry for ..#..#code#error.c.gcov in .gcno file, skipping file!
 geninfo: WARNING: cannot find an entry for ..#..#code#expand.c.gcov in .gcno file, skipping file!
 geninfo: WARNING: cannot find an entry for ..#..#code#expr.c.gcov in .gcno file,skipping file!
 geninfo: WARNING: cannot find an entry for ..#..#code#if.c.gcov in .gcno file, skipping file!
 geninfo: WARNING: cannot find an entry for ..#..#code#include.c.gcov in .gcno file, skipping file!
 geninfo: WARNING: cannot find an entry for ..#..#code#io.c.gcov in .gcno file, s kipping file!
 geninfo: WARNING: cannot find an entry for ..#..#code#is.c.gcov in .gcno file, s kipping file!
 geninfo: WARNING: cannot find an entry for ..#..#code#line.c.gcov in .gcno file,skipping file!
 geninfo: WARNING: cannot find an entry for ..#..#code#pragma.c.gcov in .gcno file, skipping file!
 geninfo: WARNING: cannot find an entry for ..#..#code#preprocess.c.gcov in .gcnofile, skipping file!
 geninfo: WARNING: cannot find an entry for ..#..#code#set.c.gcov in .gcno file,skipping file!
 geninfo: WARNING: cannot find an entry for ..#..#code#sharp.c.gcov in .gcno file, skipping file!
 geninfo: WARNING: cannot find an entry for ..#..#code#symtbl.c.gcov in .gcno file, skipping file!
 geninfo: WARNING: cannot find an entry for ..#..#code#undef.c.gcov in .gcno file, skipping file!
 geninfo: WARNING: cannot find an entry for ..#..#code#while.c.gcov in .gcno file , skipping file!

回答1:


I got the email from Peter Oberparleiter, the author of geninfo. I got the answer as following.

LCOV 1.10 has branch coverage disabled per default. You can enable it by modifying the lcovrc file (see man lcovrc) or by specifying --rc lcov_branch_coverage=1 when running lcov/genhtml.

If you're not using LCOV 1.10 and still don't get branch coverage, it may be that you're version of GCC does not provide this information.

(The above answer was erroneously added to the question by the author.)




回答2:


the solution given above :

--rc lcov_branch_coverage=1

used both for lcov and genhtml, worked for me.



来源:https://stackoverflow.com/questions/13378640/lcov-can-not-collect-branch-coverage-statistics

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!