Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lcov output format #830

Merged
merged 13 commits into from Oct 31, 2023
Merged

Conversation

Spacetown
Copy link
Member

This PR adds a writer for the LCOV info format as requested in #523.
The optional version line is filled with the MD5 of the file content.

Add scrubber for test suite to remove the root to the repository from output files.

Closes #523

@Spacetown Spacetown added this to the Upcoming release milestone Sep 19, 2023
@Spacetown Spacetown force-pushed the add_lcov_output_format branch 3 times, most recently from 7eb7fc5 to 7b788df Compare September 19, 2023 19:10
@codecov
Copy link

codecov bot commented Sep 19, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (737a496) 95.65% compared to head (d161f05) 95.27%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #830      +/-   ##
==========================================
- Coverage   95.65%   95.27%   -0.38%     
==========================================
  Files          44       54      +10     
  Lines        4347     4469     +122     
  Branches      852      873      +21     
==========================================
+ Hits         4158     4258     +100     
- Misses        111      127      +16     
- Partials       78       84       +6     
Files Coverage Δ
gcovr/configuration.py 99.50% <ø> (ø)
gcovr/formats/cobertura/__init__.py 100.00% <ø> (ø)
gcovr/formats/coveralls/__init__.py 100.00% <ø> (ø)
gcovr/formats/gcov/__init__.py 100.00% <ø> (ø)
gcovr/formats/jacoco/__init__.py 100.00% <ø> (ø)
gcovr/formats/json/__init__.py 100.00% <ø> (ø)
gcovr/formats/lcov/__init__.py 100.00% <100.00%> (ø)
gcovr/formats/txt/__init__.py 100.00% <ø> (ø)
gcovr/tests/test_gcovr.py 98.83% <100.00%> (+0.02%) ⬆️
gcovr/formats/__init__.py 90.12% <66.66%> (-0.91%) ⬇️
... and 1 more

... and 8 files with indirect coverage changes

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

@Spacetown Spacetown marked this pull request as ready for review September 19, 2023 20:30
@Spacetown
Copy link
Member Author

@latk In the linked man page man 1 geninfo of #523 there is no VER:... but in the man page I used it's added. The VSCode plugin I doesn't understand this line. Shall I comment it since it'sto new and some tools wouldn't understand the file?

@latk
Copy link
Member

latk commented Sep 20, 2023

In the linked man page man 1 geninfo of #523 there is no VER:... but in the man page I used it's added. The VSCode plugin I doesn't understand this line. Shall I comment it since it'sto new and some tools wouldn't understand the file?

The optional VER: field was added to man 1 geninfo fairly recently (this January) in this commit: linux-test-project/lcov@d98659a

I think either approach for dealing with this is OK:

  • It is perfectly reasonable to say that this field is optional, and for maximum compatibility with strict lcov-info consumers gcovr won't emit it.
  • It is also perfectly reasonable to target a specific lcov-info format version – gcovr can't support all historical versions of that format, just like gcovr doesn't support ancient GCC versions. We might as well target the newest format existing now, emit the field, and the rest of the ecosystem will eventually catch up.

Personally, I'd tend towards the latter, for two reasons:

  • Lcov itself will emit this field, so we should as well (if this can be done in a compatible manner).
  • Tools that consume the lcov-info format should skip unrecognized lines, taking into account Postel's law. Similarly, gcovr can skip over unrecognized gcov lines.

@Spacetown
Copy link
Member Author

If there are problems with the field we can add an option to skip it.

@Spacetown Spacetown requested a review from latk September 22, 2023 19:57
@Spacetown Spacetown force-pushed the add_lcov_output_format branch 4 times, most recently from 42a7b95 to 8a34335 Compare September 29, 2023 20:49
@Spacetown
Copy link
Member Author

@latk I've added an upload of a reference file to Codecov.

@Spacetown Spacetown merged commit f42ab8f into gcovr:main Oct 31, 2023
25 of 26 checks passed
@Spacetown Spacetown deleted the add_lcov_output_format branch October 31, 2023 19:40
@Spacetown Spacetown removed this from the Upcoming release milestone Jan 26, 2024
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.

Support the LCOV-Info output format
2 participants