Move coverage scripts to scripts/ directory and add Makefile targets

Reorganize coverage tooling for better project structure and easier usage.

Changes:
- Move measure_coverage.sh and generate_coverage_html.sh to scripts/
- Add Makefile targets:
  - make coverage-report: Generate text coverage summary (5s simulation)
  - make coverage-html: Generate HTML coverage report (5s simulation)
- Update measure_coverage.sh to find generate_coverage_html.sh using relative path

Usage:
  make coverage-report    # Quick text summary
  make coverage-html      # Full HTML report with branch details

The HTML report provides interactive visualization of which branches
were taken during simulation execution, with color-coded source views.
This commit is contained in:
Claude
2025-11-13 19:58:14 +00:00
parent b465d5282e
commit d288b2896f
3 changed files with 10 additions and 2 deletions
+7 -1
View File
@@ -15,12 +15,18 @@ CFILES = $(shell find src -name '*.c')
HFILES = $(shell find src -name '*.h') HFILES = $(shell find src -name '*.h')
OFILES = $(CFILES:.c=.o) OFILES = $(CFILES:.c=.o)
.PHONY: all clean coverage .PHONY: all clean coverage coverage-report coverage-html
all: mousefs$(EXT) mousefs_random_test$(EXT) example_client$(EXT) libmousefs.a all: mousefs$(EXT) mousefs_random_test$(EXT) example_client$(EXT) libmousefs.a
coverage: mousefs_random_test_coverage$(EXT) coverage: mousefs_random_test_coverage$(EXT)
coverage-report:
@./scripts/measure_coverage.sh 5
coverage-html:
@./scripts/measure_coverage.sh 5 --html
mousefs$(EXT): $(CFILES) $(HFILES) mousefs$(EXT): $(CFILES) $(HFILES)
gcc -o $@ $(CFILES) $(CFLAGS) $(LFLAGS) -Iinc -DBUILD_SERVER gcc -o $@ $(CFILES) $(CFLAGS) $(LFLAGS) -Iinc -DBUILD_SERVER
@@ -95,7 +95,9 @@ echo
# Generate HTML report if requested # Generate HTML report if requested
if [ "$2" == "--html" ]; then if [ "$2" == "--html" ]; then
echo -e "${YELLOW}Generating HTML coverage report...${NC}" echo -e "${YELLOW}Generating HTML coverage report...${NC}"
./generate_coverage_html.sh # Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
"$SCRIPT_DIR/generate_coverage_html.sh"
echo -e "${GREEN}HTML report generated in coverage_report/index.html${NC}" 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 "Open with: firefox coverage_report/index.html (or your preferred browser)"
echo echo