13

We are trying to use geninfo and genhtml (alternative to gcovr, see here) to produce an html page using coverage provided by gcov.

  • geninfo creates lcov-tracefiles from gcov's *.gcda files
  • genhtml generates html files from the above tracefiles

However, the end result includes not only our code, but also files from /usr/include.

Does anyone know of a way to exclude these?

I tried looking at the man page but could not find anything http://linux.die.net/man/1/geninfo

jww
  • 97,681
  • 90
  • 411
  • 885
Sagar
  • 9,456
  • 6
  • 54
  • 96

2 Answers2

23

If you're just looking to ignore files from /usr/include, a better option is probably "--no-external", which is intended for exactly this purpose.

lcov --no-external -d $(BLD_DIR) --capture -o .coverage.run
dbn
  • 13,144
  • 3
  • 60
  • 86
  • 2
    And as an extra: if you are building out-of-source builds; you can set source directories with `--directory` flag as much as you need, so that correct sources are found - because others will be omitted. – Ahmet Ipkin Apr 08 '16 at 12:03
21

You can use the lcov -r option to remove those files you aren't interested in.

lcov -r <input tracefile> /usr/include/\* -o <output tracefile>
Douglas Leeder
  • 52,368
  • 9
  • 94
  • 137