Use the standard lcov tools instead of custom HTML generation. Changes: - Completely rewrite generate_coverage_html.sh to use lcov - Install lcov if not available - Use lcov to capture coverage data from .gcda files - Use genhtml to create HTML reports with branch coverage - Add scripts/README.md with usage instructions Benefits: - Professional HTML reports with standard lcov styling - Better branch coverage visualization - Sortable tables by line/function/branch coverage - Source code view with execution counts - Much simpler script (30 lines vs 200+ lines) The reports now show: - 32.1% branch coverage (781/2431 branches) - 43.5% line coverage - 61.3% function coverage
49 lines
1.1 KiB
Markdown
49 lines
1.1 KiB
Markdown
# Branch Coverage Measurement
|
|
|
|
This directory contains scripts for measuring branch coverage of the random simulation.
|
|
|
|
## Prerequisites
|
|
|
|
The HTML report generation requires `lcov`:
|
|
|
|
```bash
|
|
sudo apt-get install lcov
|
|
```
|
|
|
|
## Usage
|
|
|
|
### Quick text summary (5 second simulation)
|
|
```bash
|
|
make coverage-report
|
|
```
|
|
|
|
### HTML report with branch details (5 second simulation)
|
|
```bash
|
|
make coverage-html
|
|
```
|
|
|
|
### Custom duration
|
|
```bash
|
|
./scripts/measure_coverage.sh 10 # 10 second run, text output
|
|
./scripts/measure_coverage.sh 10 --html # 10 second run, HTML output
|
|
```
|
|
|
|
## What gets measured
|
|
|
|
The coverage tool:
|
|
- Builds the test binary with coverage instrumentation (`--coverage` flag)
|
|
- Runs the random simulation for the specified duration
|
|
- Generates reports showing which branches were executed
|
|
|
|
## Output
|
|
|
|
**Text report**: Shows per-file and total branch coverage percentages
|
|
|
|
**HTML report**: Interactive report generated by lcov/genhtml showing:
|
|
- Overall coverage summary
|
|
- Per-file coverage breakdown
|
|
- Source code with execution counts
|
|
- Branch coverage details
|
|
|
|
The HTML report is generated in `coverage_report/index.html`
|