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 option to ignore function coverage #430

Merged

Conversation

Spacetown
Copy link
Member

If coverage isn't ignored, the JSON output is extended with property 'gcovr/function' with value True/False.

close #398

Spacetown added a commit to Spacetown/gcovr that referenced this pull request Oct 7, 2020
If coverage isn't ignored, the JSON output is extended with property 'gcovr/function' with value True/False.
@Spacetown Spacetown force-pushed the add_option_to_ignore_function_coverage_398 branch from 76b9824 to fc0ada5 Compare October 7, 2020 20:03
@codecov
Copy link

codecov bot commented Oct 7, 2020

Codecov Report

Merging #430 (9aa0d49) into master (2aef434) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #430      +/-   ##
==========================================
+ Coverage   95.52%   95.54%   +0.01%     
==========================================
  Files          20       20              
  Lines        2459     2469      +10     
  Branches      420      423       +3     
==========================================
+ Hits         2349     2359      +10     
  Misses         48       48              
  Partials       62       62              
Flag Coverage Δ
ubuntu-18.04 95.05% <100.00%> (+0.02%) ⬆️
windows-2019 95.13% <95.45%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
gcovr/configuration.py 99.28% <ø> (ø)
gcovr/tests/test_gcov_parser.py 100.00% <ø> (ø)
gcovr/gcov.py 88.13% <100.00%> (+0.34%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2aef434...9aa0d49. Read the comment docs.

Spacetown added a commit to Spacetown/gcovr that referenced this pull request Nov 20, 2020
If coverage isn't ignored, the JSON output is extended with property 'gcovr/function' with value True/False.
@Spacetown Spacetown force-pushed the add_option_to_ignore_function_coverage_398 branch from fc0ada5 to e0e84cf Compare November 20, 2020 21:04
Spacetown added a commit to Spacetown/gcovr that referenced this pull request Nov 20, 2020
If coverage isn't ignored, the JSON output is extended with property 'gcovr/function' with value True/False.
@Spacetown Spacetown force-pushed the add_option_to_ignore_function_coverage_398 branch from e0e84cf to 66eafcb Compare November 20, 2020 21:26
gcovr/configuration.py Outdated Show resolved Hide resolved
gcovr/gcov.py Outdated Show resolved Hide resolved
gcovr/json_generator.py Outdated Show resolved Hide resolved
@Spacetown Spacetown force-pushed the add_option_to_ignore_function_coverage_398 branch from 5dfe3dd to 90b6d2d Compare November 30, 2020 21:10
Spacetown added a commit to Spacetown/gcovr that referenced this pull request Dec 1, 2020
If coverage isn't ignored, the JSON output is extended with property 'gcovr/function' with value True/False.
@Spacetown Spacetown force-pushed the add_option_to_ignore_function_coverage_398 branch 12 times, most recently from d5bdbaf to 6c3f557 Compare December 7, 2020 19:27
Spacetown added a commit to Spacetown/gcovr that referenced this pull request Dec 10, 2020
If coverage isn't ignored, the JSON output is extended with property 'gcovr/function' with value True/False.
@Spacetown Spacetown force-pushed the add_option_to_ignore_function_coverage_398 branch from 6c3f557 to 47a5b14 Compare December 10, 2020 20:30
Spacetown added a commit to Spacetown/gcovr that referenced this pull request Jan 4, 2021
If coverage isn't ignored, the JSON output is extended with property 'gcovr/function' with value True/False.
@Spacetown Spacetown force-pushed the add_option_to_ignore_function_coverage_398 branch from 47a5b14 to 76582c6 Compare January 4, 2021 18:51
Spacetown added a commit to Spacetown/gcovr that referenced this pull request Jan 7, 2021
If coverage isn't ignored, the JSON output is extended with property 'gcovr/function' with value True/False.
@Spacetown Spacetown force-pushed the add_option_to_ignore_function_coverage_398 branch from 76582c6 to 7179bae Compare January 7, 2021 18:43
Spacetown added a commit to Spacetown/gcovr that referenced this pull request Jan 20, 2021
If coverage isn't ignored, the JSON output is extended with property 'gcovr/function' with value True/False.
@Spacetown Spacetown force-pushed the add_option_to_ignore_function_coverage_398 branch from 7179bae to 8f40935 Compare January 20, 2021 20:50
@Spacetown Spacetown requested a review from latk January 28, 2021 19:31
Spacetown added a commit to Spacetown/gcovr that referenced this pull request Jan 30, 2021
If coverage isn't ignored, the JSON output is extended with property 'gcovr/function' with value True/False.
@Spacetown Spacetown force-pushed the add_option_to_ignore_function_coverage_398 branch from 8f40935 to d4bca2c Compare January 30, 2021 21:49
Copy link
Member

@latk latk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a changelog entry, otherwise ready to go :) Thanks for working on this.

Potential future directions:

  • The gcov parser state machine is growing more and more complex. Perhaps it would be possible to separate this into a textual part that generates events for each line, and then various event consumers with simpler state machines that update the coverage data structure. For example when reviewing this code, I was unsure where the last_was_function_marker was being reset because it was spread over so many lines.

  • For each compiler version, we are generating all output formats. This requires extra effort when updating reference files and slows down the test suite. It would be sufficient to only test JSON output for individual compilers, since the other outputs can be generated from JSON without depending on any compiler. So we could move from O(compilers × outputs) tests to O(compilers + outputs). In some places, the test suite has already been rewritten to use JSON as an intermediate format but the JSON isn't reused between tests and the tests still depend on freshly generated JSON (requiring a compiler).

Spacetown added a commit to Spacetown/gcovr that referenced this pull request Feb 8, 2021
If coverage isn't ignored, the JSON output is extended with property 'gcovr/function' with value True/False.
@Spacetown Spacetown force-pushed the add_option_to_ignore_function_coverage_398 branch from d4bca2c to f4c2069 Compare February 8, 2021 18:38
@Spacetown
Copy link
Member Author

@latk I've rebased and added the issue to the changelog.
The event based parser is a good idea but first I'll create an abstract interface for readers and writers as discussed in #443.
I think we can't remove the call of gcc in the whole test suite because also the gcov parser must be tested. But the tests of the writer can be improved here.

@latk latk added this to the 4.3 milestone Feb 8, 2021
CHANGELOG.rst Outdated
@@ -33,6 +33,7 @@ Improvements and new features:
- Only remove :option:`--root` path at the start of file paths. (:issue:`452`)
- Fix coverage report for cmake ninja builds with given in-source object-directory. (:issue:`453`)
- Add issue templates. (:issue:`461`)
- Add :option:`--exclude-function-coverage` to exclude the line of the function definition in the coverage report. (:issue:`430`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Building the sphinx docs found an error for us:

Suggested change
- Add :option:`--exclude-function-coverage` to exclude the line of the function definition in the coverage report. (:issue:`430`)
- Add :option:`--exclude-function-lines` to exclude the line of the function definition in the coverage report. (:issue:`430`)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, currently I'm rebasing and updating the test data.

@Spacetown Spacetown force-pushed the add_option_to_ignore_function_coverage_398 branch from f4c2069 to f30bc56 Compare February 8, 2021 19:51
@Spacetown Spacetown force-pushed the add_option_to_ignore_function_coverage_398 branch from f30bc56 to 9aa0d49 Compare February 8, 2021 19:52
@Spacetown Spacetown merged commit 4411a32 into gcovr:master Feb 8, 2021
@Spacetown Spacetown deleted the add_option_to_ignore_function_coverage_398 branch February 8, 2021 19:59
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.

Why Coverage does not hit the name of functions ?
2 participants