FramaCovr
FramaCovr turns the JSON coverage reports emitted by the
Frama-C metrics plugin into a
gcovr compliant JSON report.
The resulting file can then be consumed by gcovr itself in order to produce an HTML report, a SonarQube coverage import file, a Cobertura report, and so on.
Usage
framacovr \
--framac-metrics-files given-framac-run-metrics-coverage.json \
another-framac-run-metrics-coverage.json \
--source-dirs kernel/src kernel/include \
--source-root . \
-o framacovr.json
Then, with gcovr:
mkdir -p coverage-html
gcovr \
--root . \
--json-add-tracefile framacovr.json \
--html-details coverage-html/coverage.html
gcovr \
--root . \
--json-add-tracefile framacovr.json \
--sonarqube coverage.xml
gcovr \
--root . \
--json-add-tracefile framacovr.json \
--txt
Use the same directory for FraMaCovr --source-root and gcovr --root so
that gcovr can resolve the source paths written in the JSON report. The
--html-details output path also controls where gcovr writes the generated
HTML, CSS and per-file pages.
FraMaCovr options
| Option | Description |
|---|---|
--framac-metrics-files FILE... |
Frama-C metrics reports in JSON format |
--source-dirs DIR... |
Directories holding the analysed .c and .h files. |
--source-root DIR |
Directory to strip from source paths written in the gcovr report, . by default. |
-o, --output FILE |
Destination of the gcovr report, absolute or relative to the current directory, framacovr.json by default. |
--gcovr-format-version VERSION |
gcovr JSON format version to emit, 0.6 by default (gcovr 7.x). |
-v, --verbose |
Increase verbosity, may be repeated. |
gcovr options used above
| Option | Description |
|---|---|
--root DIR |
Root directory used by gcovr to resolve source paths from the JSON report. Use the same value as --source-root. |
--json-add-tracefile FILE |
Read the JSON tracefile generated by FraMaCovr. |
--html-details FILE |
Generate the HTML report with per-file detail pages next to the given output file. |
--sonarqube FILE |
Export the same coverage data to SonarQube XML. |
--txt |
Print a text summary, useful to verify the total coverage percentage. |
How it works
- Each
metricsreport is read. Thedefined-functionsnode provides the number of calls of every reached symbol, and theentry-pointsnode lists the traversed symbols. - Frama-C symbol instances are canonicalised: a
_<n>suffix denotes astaticinstance and a__fc_inline_<n>suffix astatic inlineone. All the instances of a given function are merged into a single entry, and their call counts are summed. - The source directories are walked and parsed with tree-sitter and its C grammar, in order to bind each function name to its implementation file and to its executable source lines.
- A gcovr JSON document is emitted. A function called at least once is considered
covered, and all its executable lines carry its call count. Source paths are
reported relatively to
--source-root, which defaults to the current working directory.
Limitations
- Frama-C only provides a function level coverage. Line counts are therefore uniform inside a function, and no branch, condition or decision coverage is reported.
- Sources are parsed without being preprocessed. When a function has several
variants guarded by
#if/#elsein the same file, only the first one is reported. - A
staticfunction defined with the same name in several translation units cannot be distinguished from themetricsoutput. The merged call count is then reported for each implementation. - Functions reported by Frama-C but implemented outside of the given source
directories (libc stubs, builtins,
specified-only-functions) are not part of the report. Run with-vto get their number.
Development
The project requires Python 3.11 or newer. Run all quality checks with:
tox
Build the source and wheel distributions with:
python -m build
License
FraMaCovr is distributed under the Apache License 2.0.
Metadata
Release files for framacovr 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| framacovr-0.1-py3-none-any.whl | Python 3 | none | any | Details for framacovr-0.1-py3-none-any.whl |
Release files / framacovr-0.1-py3-none-any.whl
| Download URL | framacovr-0.1-py3-none-any.whl |
|---|---|
| Size | 24.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
14918bb70b84b76988c9a1a8303a20bae0a724945a682b8b4584143eba1e2515
|
|
BLAKE2b-256 checksum How to use checksums |
54328c81a1b69b96abd8e00aff421815e622d38df544f8a7fa3b90e3571dced0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Security for framacovr 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.