Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Spacetown
Copy link
Member

If more than 9999 code lines are present there is no space in front of the block number printed by gcov. Add support for optional spaces.

Closes #882

@Spacetown Spacetown added this to the Upcoming release milestone Feb 7, 2024
@codecov
Copy link

codecov bot commented Feb 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (088f491) 95.27% compared to head (d025c7c) 95.27%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #883   +/-   ##
=======================================
  Coverage   95.27%   95.27%           
=======================================
  Files          54       54           
  Lines        4525     4525           
  Branches      893      893           
=======================================
  Hits         4311     4311           
  Misses        130      130           
  Partials       84       84           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Spacetown Spacetown force-pushed the add_support_for_more_than_9999_lines branch from 8df9e2b to 94bafb8 Compare February 7, 2024 21:59
@latk
Copy link
Member

latk commented Feb 9, 2024

Instead of using an end-to-end test case with a file containing over 10k lines, it might be sufficient to just test this on the gcov parser level and add an example to the parser's doctests. Something like:

>>> _parse_line("    %%%%%:12345-block  0")  # see https://github.com/gcovr/gcovr/issues/882
_BlockLine(hits=0, lineno=12345, blockno=0, extra_info=NONE)

As a general point, the gcovr test suite is fairly detailed but also extremely slow, and maintaining the "golden master" files is tedious (especially for XML and HTML formats). Wherever we can check something via a cheap unit test, we should prefer that.

One thing I've wanted to do (when I have the energy, so probably never) would be to review the test suite, remove tests for formats that aren't needed (so probably preferring JSON tests over HTML tests when testing reader functionality, preferring JSON inputs over running gcov when testing writer-side functionality), porting Makefiles to Python test modules to reduce re-building and process spawning overhead, and maybe even finding a way to use pytest-xdist for parallelization. Once there are fewer golden master files, it would also be easier to drop ancient GCC versions.

@Spacetown
Copy link
Member Author

Instead of using an end-to-end test case with a file containing over 10k lines, it might be sufficient to just test this on the gcov parser level and add an example to the parser's doctests. Something like:

>>> _parse_line("    %%%%%:12345-block  0")  # see https://github.com/gcovr/gcovr/issues/882
_BlockLine(hits=0, lineno=12345, blockno=0, extra_info=NONE)

I'll update this.

As a general point, the gcovr test suite is fairly detailed but also extremely slow, and maintaining the "golden master" files is tedious (especially for XML and HTML formats). Wherever we can check something via a cheap unit test, we should prefer that.

One thing I've wanted to do (when I have the energy, so probably never) would be to review the test suite, remove tests for formats that aren't needed (so probably preferring JSON tests over HTML tests when testing reader functionality, preferring JSON inputs over running gcov when testing writer-side functionality), porting Makefiles to Python test modules to reduce re-building and process spawning overhead, and maybe even finding a way to use pytest-xdist for parallelization. Once there are fewer golden master files, it would also be easier to drop ancient GCC versions.

In this case we should also consider to remove the makefiles and use a python based test configuration. I was also thinking about this change.

@Spacetown Spacetown force-pushed the add_support_for_more_than_9999_lines branch from 7be01bb to d025c7c Compare February 11, 2024 19:32
@Spacetown Spacetown merged commit 1c0e1d5 into gcovr:main Feb 11, 2024
@Spacetown Spacetown deleted the add_support_for_more_than_9999_lines branch February 11, 2024 19:50
speth added a commit to speth/cantera that referenced this pull request Feb 25, 2024
Already fixed upstream (gcovr/gcovr#883), so
future versions of gcovr should work fine.
@Spacetown Spacetown removed this from the Upcoming release milestone Feb 25, 2024
ischoegl pushed a commit to Cantera/cantera that referenced this pull request Feb 26, 2024
Already fixed upstream (gcovr/gcovr#883), so
future versions of gcovr should work fine.
D-Walther pushed a commit to D-Walther/gcovr that referenced this pull request Jun 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UnknownLineType thrown when parsing coverage data from 10K+ line file

2 participants