1

I tried two ways to add LCOV_EXCL_LINE in my code.

  1. I add it as comment, compile and generate lcov report but lcov binary takes it as a comment and showing the coverage of excluded line.
    Image showing coverage of excluded line:
    Image showing coverage of excluded line

  2. After compilation and execution I add LCOV_EXCL_LINE before running lcov and genhtml binaries but it results in misalignment after first exclusion.
    Image showing misalignment coverage:
    Image showing misalignment coverage

1737973
  • 159
  • 18
  • 42
  • I am taking coverage of compiler front end source code, their are multiple directories and files. For other references I just wrote a code(images attached) and did exactly the same thing what I did in my source code. I guess that is explainable, I am not getting how to add this marker. Did u know that ? – Aakash Shah May 09 '18 at 08:42

2 Answers2

6

You add the comment in the line you want excluded. Not in the line before that you want excluded.

1737973
  • 159
  • 18
  • 42
0

As 1737973 said, you should do something like:

printf("* ")  // LCOV_EXCL_LINE
printf("\n")  // LCOV_EXCL_LINE
Luiz
  • 389
  • 3
  • 3