You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This works great and would exclude for instance lines with /* TESTPLATFORM_EXCL_LINE */ when the make target is TESTPLATFORM.
I am wondering if this option is intended too for creating custom block excludes. For instance if I try on a regex checker the regex .* TESTPLATFORM_EXCL_LINE_START(\n|.)*?TESTPLATFORM_EXCL_LINE_STOP.*
would match any code encapsulated by comments with TESTPLATFORM_EXCL_LINE_START and TESTPLATFORM_EXCL_LINE_STOP
And there it is mentioned "the option is intended to override Gcovr's default exclusion pattern" and "you can combine multiple patterns for this option with |"
Therefore I thought I would simply add gcovr --exclude-lines-by-pattern '^.*$(PLATFORM)_EXCL_LINE.*$$'|$(PLATFORM)_EXCL_LINE_START(\n|.)*?$(PLATFORM)_EXCL_LINE_STOP'
or for easier testing in gcovr.cfg. exclude-lines-by-pattern=TESTPLATFORM_EXCL_LINE_START(\n|.)*?TESTPLATFORM_EXCL_LINE_STOP|^.*TESTPLATFORM_EXCL_LINE.*$
or alternatively only the block exclude: exclude-lines-by-pattern=.*TESTPLATFORM_EXCL_LINE_START(\n|.)*?TESTPLATFORM_EXCL_LINE_STOP.*
However none of these works for the block exclude. I guess I misunderstand the option and indeed you can only use it for custom single line excludes?
The text was updated successfully, but these errors were encountered:
The --exclude-lines-by-pattern is only for lines and not for blocks. If you define --exclude-pattern-prefix=TESTPLATFORM you will activate the markers TESTPLATFORM_EXCL_LINE, TESTPLATFORM_EXCL_START and TESTPLATFORM_EXCL_STOP. In this case the default markers starting with GCOVR, LCOVR, GCOV or LCOV.
Like that you are still able to use the standard GCOV_EXCL_LINE, GCOV_EXCL_START and so on together with a platform specific exclude, i.e. GCOVR_TEST_PLATFORM_EXCL_START.
So I was simply trying with the wrong option. Great how you implemented this so configurable!
I am using the gcovr --exclude-lines-by-pattern option inside a Makefile in order to have platform specific exclude markers:
gcovr --exclude-lines-by-pattern '^.*$(PLATFORM)_EXCL_LINE.*$$'
This works great and would exclude for instance lines with
/* TESTPLATFORM_EXCL_LINE */
when the make target is TESTPLATFORM.I am wondering if this option is intended too for creating custom block excludes. For instance if I try on a regex checker the regex
.* TESTPLATFORM_EXCL_LINE_START(\n|.)*?TESTPLATFORM_EXCL_LINE_STOP.*
would match any code encapsulated by comments with TESTPLATFORM_EXCL_LINE_START and TESTPLATFORM_EXCL_LINE_STOP
I have seen the discussion on this issue
#675
And there it is mentioned "the option is intended to override Gcovr's default exclusion pattern" and "you can combine multiple patterns for this option with |"
Therefore I thought I would simply add
gcovr --exclude-lines-by-pattern '^.*$(PLATFORM)_EXCL_LINE.*$$'|$(PLATFORM)_EXCL_LINE_START(\n|.)*?$(PLATFORM)_EXCL_LINE_STOP'
or for easier testing in gcovr.cfg.
exclude-lines-by-pattern=TESTPLATFORM_EXCL_LINE_START(\n|.)*?TESTPLATFORM_EXCL_LINE_STOP|^.*TESTPLATFORM_EXCL_LINE.*$
or alternatively only the block exclude:
exclude-lines-by-pattern=.*TESTPLATFORM_EXCL_LINE_START(\n|.)*?TESTPLATFORM_EXCL_LINE_STOP.*
However none of these works for the block exclude. I guess I misunderstand the option and indeed you can only use it for custom single line excludes?
The text was updated successfully, but these errors were encountered: