我在Windows 10上使用从此处http://ltp.sourceforge.net/coverage/lcov.php下载的lcov
的最新版本。我能够生成看似有效的.gcda,.gcno和.info文件。此外,当我运行gcov时,它会输出一个有效的.gcov文件。但是,当我在.info文件上运行genhtml
时,我得到以下输出:
C:\Users\Yuxin Zhou\Documents\work\gcov_test>genhtml.pl coverage.info
Reading data file coverage.info
Found 1 entries.
No common filename prefix found!
Writing .css and .png files.
Generating output.
Writing directory view page.
Overall coverage rate:
lines......: no data found
functions..: no data found
这是我的批处理文件:
gcc -O0 --coverage test.c -o test.exe
test.exe
gcov test.c
lcov.pl -o coverage.info -c -d "C:\Users\Nick\Documents\work\gcov_test"
genhtml.pl coverage.info --output-directory html
这是gcov的输出:
-: 0:Source:test.c
-: 0:Graph:test.gcno
-: 0:Data:test.gcda
-: 0:Runs:1
-: 0:Programs:1
-: 1:#include <stdio.h>
-: 2:
1: 3:int happy_now(int x)
-: 4:{
1: 5: return x + 2;
-: 6:}
-: 7:
1: 8:int main()
-: 9:{
1: 10: int x = happy_now(3);
-: 11:
1: 12: if(x == 0)
-: 13: {
#####: 14: printf("hello world\n");
-: 15: }
-: 16: else
-: 17: {
1: 18: printf("goodbye world\n");
-: 19: }
-: 20:}
为什么我
Overall coverage rate:
lines......: no data found
functions..: no data found