-
Notifications
You must be signed in to change notification settings - Fork 41
Coverage integration #110
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
Coverage integration #110
Conversation
JPF2209
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are some things I would suggest adding before this is finalised
- For step 1 of the guide, in linux, this command worked "sudo apt install lcov" where the original didn't
- For step 7 of the guide, this command workds "cmake --build build/ --target capture-coverage" where the original didn't
- For step 9 of the guide, to view the html where the file was made successfully, I needed run sudo apt update && sudo apt install wslu before running wslview index.html but I would just suggest that for this, unless you want to provide explicit instructions say that to view this, you need to install other libraries and use different methods to do this yourself.
Type of Change
- New feature
Code Quality
- Repository: Is this Pull Request is made to the correct repository? (Thoth-Tech NOT SplashKit)
- Readability: Is the code easy to read and follow? If not are there comments to help understand
the code? - Maintainability: Can this code be easily maintained or extended in the future?
Functionality
- Correctness: Does the code meet the requirements of the task?
- Impact on Existing Functionality: Has the impact on existing functionality been considered and
tested?
Testing
- Test Coverage: Are unit tests provided for new or modified code?
- Test Results: Have all tests passed?
Documentation
- Documentation: Are both inline and applicable external documentation updated and clear?
Pull Request Details
- PR Description: Is the problem being solved clearly described?
- Checklist Completion: Have all relevant checklist items been reviewed and completed?
…into pr/dijidiji/110
…into pr/dijidiji/110
|
Hi @dijidiji - I haven't been able to test this fully, so I am merging it into the "unit-test-coverage" branch that I've just created (and will merge the other related PR as well). This way you can continue with this, and make any changes/improvements to this based on how things go in T2. |
Description
Code coverage will be helpful for unit testing to get an idea of how much of the codebase is being tested. This draft PR includes CMake presets for Linux/WSL and Mac, plus custom targets that perform the coverage collection process with LCOV or gcovr. Efforts to get it working with MSYS have been unsuccessful so far (any help here would be greatly appreciated!)
Expands on #106.
For anyone who'd like to try it:
For macOS install gcovr with homebrew:
brew install gcovr.For Linux/WSL use your package manager to install lcov, e.g. apt:
apt install lcovcd projects/cmakecmake --preset [LinuxCoverage | macOSCoverage]cmake --build build/ --target skunit_testsCapture coverage (macOS):
../../bin/skunit_testscmake --build build/ --target --gcovr-capture-coveragegenhtml build/lcov.info -o coverage-reportCapture coverage (Linux):
cmake --build build/ --target lcov-init-coverage../../bin/skunit_testscmake --build build/ --target --lcov-capture-coveragegenhtml build/lcov.info -o coverage-reportThe CMake Tools extension for VS Code can integrate the code coverage report and automatically execute the coverage targets before and after testing (instructions for that are WIP)
Type of change
How Has This Been Tested?
Coverage has been tested on Linux/WSL and generates reports successfully. Mac hasn't been tested.
Checklist