- Notifications
You must be signed in to change notification settings - Fork0
generate code coverage reports with gcc/gcov
License
Spacetown/gcovr
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
generate GCC code coverage reports
website and documentation •bugtracker •GitHub
Gcovr provides a utility for managing the use of the GNUgcov utilityand generating summarized code coverage results. This command isinspired by the Pythoncoverage.py package, which provides a similarutility for Python.
Thegcovr command can produce different kinds of coverage reports:
| CLI Option | User Guide | Description |
|---|---|---|
default,--txt | Text Output | compact human-readable summaries |
--html | HTML Output | overview of all files |
--html-details | HTML Output | annotated source files |
--html-template-dir | HTML Output | use custom set of Jinja2 templates |
--csv | CSV Output | CSV report summarizing the coverage of each file |
--json | JSON Output | JSON report with source file structure and coverage |
--json-summary | JSON Output | JSON summary coverage report |
--markdown | Markdown Output | Markdown coverage report |
--markdown-summary | Markdown Output | Markdown summary coverage report |
--clover | Clover XML Output | machine readable XML reports inClover format |
--cobertura | Cobertura XML Output | machine readable XML reports inCobertura format |
--coveralls | Coveralls JSON Output | machine readable JSON report inCoveralls format |
--jacoco | JaCoCo XML Output | machine readable XML reports inJaCoCo format |
--lcov | LCOV info Output | machine readable report inLCOV info format |
--sonarqube | SonarQube XML Output | machine readable XML reports inSonarQube format |
Thus, gcovr can be viewedas a command-line alternative to thelcov utility, which runs gcovand generates an HTML-formatted report.The development of gcovr was motivated by the need fortext summaries and XML reports.
Example HTML summary:
Example HTML details:
Gcovr is available as a Python package that can be installed viapip.
Install newest stablegcovr release from PyPI:
pip install gcovr
Install development version from GitHub (needs at least version 21.3 of pip):
pip install git+https://github.com/gcovr/gcovr.git
GCC can instrument the executables to emit coverage data.You need to recompile your code with the following flags:
--coverage -g -O0
Next, run your test suite.This will generate raw coverage files.
Finally, invoke gcovr.This will print a tabular report on the console.
gcovr
You can also generate detailed or nested HTML reports:
gcovr --html-details coverage.htmlgcovr --html-nested coverage.html
Gcovr will create one HTML report per source file and for--html-nested also per directory next to the coverage.htmlsummary.
You should run gcovr from the build directory.The-r option should point to the root of your project.This only matters if you have a separate build directory.For example:
cd build; gcovr -r ..
For complete documentation, read themanual.
If you want to report a bug or contribute to gcovr development,please read our contributing guidelines first:https://gcovr.com/en/latest/contributing.html
This software is distributed under the 3-clause BSD License.Seehttps://gcovr.com/en/latest/license.html#license-terms for details.Seehttps://gcovr.com/en/latest/license.html#acknowledgementsfor the full list of contributors.
About
generate code coverage reports with gcc/gcov
Resources
License
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Languages
- Python84.0%
- C++7.7%
- HTML6.3%
- CSS1.6%
- C0.2%
- Jinja0.1%
- Other0.1%

