2

I am using the latest version of lcov downloaded from here http://ltp.sourceforge.net/coverage/lcov.php on Windows 10. I am able to generate .gcda, .gcno, and .info files that appear valid. Also, when I run gcov, it outputs a valid .gcov file. However, when I run genhtml on the .info file, I get the following output:

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

Here is my batch file:

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

Here's the output from 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:}

Why do I get

Overall coverage rate:
  lines......: no data found
  functions..: no data found

?

hacksoi
  • 1,301
  • 13
  • 23

0 Answers0