C++ code coverage support#905
Merged
rapids-bot[bot] merged 6 commits intorapidsai:branch-21.12from Nov 9, 2021
Merged
Conversation
rongou
approved these changes
Nov 4, 2021
robertmaynard
approved these changes
Nov 9, 2021
Member
Author
|
@gpucibot merge |
ajschmidt8
approved these changes
Nov 9, 2021
rapids-bot bot
pushed a commit
that referenced
this pull request
Dec 1, 2021
Now that #905 added C++ code coverage support, this PR improves test coverage. Much of the improvement comes from adding a new `adaptor_test.cpp` which generically tests the common functions of all 7 adaptor types. Small test additions improve coverage of many other files as well. At least one typo bug was uncovered and fixed. If you build with `-DCODE_COVERAGE=ON -DRMM_LOGGING_LEVEL=TRACE`, overall code coverage is now 99.5% and all but one file has 100% coverage. That one file, arena.hpp is undergoing work concurrent to this PR, and improvement to 100% requires additional testing that might be best undertaken by @rongou, so I will leave it.  Authors: - Mark Harris (https://github.com/harrism) Approvers: - Robert Maynard (https://github.com/robertmaynard) - Rong Ou (https://github.com/rongou) - Jake Hemstad (https://github.com/jrhemstad) URL: #920
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a cmake option (
CODE_COVERAGE) to compile a build with relevant options to GCC and NVCC to generate code coverage profiling.This can then be used with coverage tools like
gcovror coveralls to generate a detailed coverage summary (e.g. in HTML, JSON, XML, etc.).Also adds a gcovr.cfg with basic options and a conda dependency on gcovr.
Finally, it adds some explicit template instantiations in test files to ensure all template class methods are included in coverage analysis (so coverage % isn't artificially high).(reserved for future PR)Instructions for generating code coverage
Note that parallel building should not be used, because
--keepis used with .cu files.With rapids-compose, just set build type to Debug in .env, then
Then open
build/debug/coverage/coverage_details.html. It looks like this:Summary of changes required to get good coverage analysis:
--coverage,-fprofile-abs-path,-fkeep-inline-functions,-fno-elide-constructorsand link with--coverage.--keep(otherwise gcov gets errors finding NVCC's deleted intermediate-stage files)Explicitly instantiate template classes at least once in test source files. This ensures any unused methods in these classes get shown as not covered by tests.Reserved for a future PR to improve code coverage.