Add HTML coverage reports with branch-level detail

Enhance the branch coverage measurement tool with HTML report generation
that shows exactly which branches were taken during simulation execution.

Changes:
- Add generate_coverage_html.sh script to create interactive HTML reports
- Update measure_coverage.sh with --html flag to generate reports
- Add *.gcov, *.gcda, *.gcno to .gitignore
- HTML reports show:
  - Overall coverage summary with visual progress bars
  - Per-file coverage breakdown with clickable links
  - Source code view with color-coded branch coverage
  - Green highlight: branches taken
  - Red highlight: branches not taken
  - Branch execution counts and percentages

Usage:
  ./measure_coverage.sh [duration] --html

The HTML report is generated in coverage_report/index.html and can be
viewed in any web browser. Each source file links to a detailed view
showing which specific branches were executed.
This commit is contained in:
Claude
2025-11-13 19:55:08 +00:00
parent 4b97b176bd
commit b465d5282e
3 changed files with 370 additions and 7 deletions
+12 -7
View File
@@ -92,15 +92,20 @@ fi
echo -e "${BLUE}========================================${NC}"
echo
# Optionally show detailed coverage for specific files
if [ "$2" == "--detailed" ]; then
echo -e "${YELLOW}Detailed coverage reports available in *.gcov files${NC}"
echo "Use 'less <filename>.gcov' to view detailed line and branch coverage"
# Generate HTML report if requested
if [ "$2" == "--html" ]; then
echo -e "${YELLOW}Generating HTML coverage report...${NC}"
./generate_coverage_html.sh
echo -e "${GREEN}HTML report generated in coverage_report/index.html${NC}"
echo "Open with: firefox coverage_report/index.html (or your preferred browser)"
echo
fi
# Clean up gcov files
echo -e "${YELLOW}Cleaning up coverage files...${NC}"
rm -f *.gcov
# Clean up gcov files unless HTML was requested
if [ "$2" != "--html" ] && [ "$2" != "--detailed" ]; then
echo -e "${YELLOW}Cleaning up coverage files...${NC}"
rm -f *.gcov
fi
echo
echo -e "${GREEN}Coverage measurement complete!${NC}"