Skip to content

Commit 909870b

Browse files
committed
[docs] Add gcov instructions in readme and contributing
1 parent 0a919f6 commit 909870b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

CONTRIBUTING.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- [Extending public API](#extending-public-api)
1111
- [License](#license)
1212
- [Adding new dependency](#adding-new-dependency)
13+
- [Code coverage](#code-coverage)
1314

1415
Below you'll find instructions on how to contribute to UMF, either with code changes
1516
or issues. All contributions are most welcome!
@@ -202,3 +203,20 @@ New dependency: dependency_name
202203
license: SPDX license tag
203204
origin: https://dependency_origin.com
204205
```
206+
207+
## Code coverage
208+
209+
After adding a new functionality add tests and check coverage before and after the change.
210+
To do this, enable coverage instrumentation by turning on the USE_GCOV flag in CMake.
211+
Coverage instrumentation feature is supported only by GCC and Clang.
212+
An example flow might look like the following:
213+
214+
```bash
215+
$ cmake -B build -DUSE_GCOV=1 -DCMAKE_BUILD_TYPE=Debug
216+
$ cmake --build build -j
217+
$ cd build
218+
$ ctest
219+
$ apt install lcov
220+
$ lcov --capture --directory . --output-file coverage.info
221+
$ genhtml -o html_report coverage.info
222+
```

0 commit comments

Comments
 (0)