Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/claremacrae/catch_cmake_coverage
Integration of Catch, CMake and CMake CodeCoverage module and basic examples in C++.
https://github.com/claremacrae/catch_cmake_coverage
Last synced: about 1 month ago
JSON representation
Integration of Catch, CMake and CMake CodeCoverage module and basic examples in C++.
- Host: GitHub
- URL: https://github.com/claremacrae/catch_cmake_coverage
- Owner: claremacrae
- License: mit
- Created: 2019-11-18T13:33:05.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-02T17:31:02.000Z (about 5 years ago)
- Last Synced: 2024-10-31T17:12:28.378Z (3 months ago)
- Language: C++
- Homepage:
- Size: 104 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cmake_catch_coverage
Integration of CMake, Catch and CMake CodeCoverage module for C++ code.
(CMake CodeCoverage depends on: gcov, gcovr, genhtml, lcov.)## Setup
install test build environment tools (Ubuntu)
./setup.sh
## Usage
test build and test execution (with junit format .xml result piping into `build/unit_test_result.xml`, without coverage analysis)
cd build/
cmake ..
make unit_tests
./unit_tests -r junit > unit_test_result.xmltest build, test execution (with coverage analysis) and coverage observation
cd build/
cmake .. -DENABLE_CODE_COVERAGE=on
make unit_tests_coverage
xdg-open ./unit_tests_coverage/index.html## Clare Macrae's extra notes
### Generating branch coverage
Based on [this question](https://stackoverflow.com/questions/12360167/generating-branch-coverage-data-for-lcov), you need to have the following lines enabled in your `~/.lcovrc` file:
```
genhtml_branch_coverage = 1
lcov_branch_coverage = 1
```On a Mac, with lcov installed via brew, you will want to look at `/usr/local/etc/lcovrc`, not `/etc/lcovrc`
See the reference docs: [lcovrc - lcov configuration file](http://ltp.sourceforge.net/coverage/lcov/lcovrc.5.php).
### Excluding Catch2 test macros from the branch coverage
Add this to your `~/.lcovrc` file:
```
lcov_excl_br_line = LCOV_EXCL_BR_LINE|CHECK|REQUIRE
```