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.
64 lines
1.6 KiB
Makefile
64 lines
1.6 KiB
Makefile
|
|
CFLAGS = -Wall -Wextra -ggdb
|
|
COVERAGE_CFLAGS = $(CFLAGS) --coverage
|
|
COVERAGE_LFLAGS = --coverage
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
LFLAGS = -lws2_32
|
|
EXT = .exe
|
|
else
|
|
LFLAGS =
|
|
EXT = .out
|
|
endif
|
|
|
|
CFILES = $(shell find src -name '*.c')
|
|
HFILES = $(shell find src -name '*.h')
|
|
OFILES = $(CFILES:.c=.o)
|
|
|
|
.PHONY: all clean coverage coverage-report coverage-html
|
|
|
|
all: mousefs$(EXT) mousefs_random_test$(EXT) example_client$(EXT) libmousefs.a
|
|
|
|
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)
|
|
gcc -o $@ $(CFILES) $(CFLAGS) $(LFLAGS) -Iinc -DBUILD_SERVER
|
|
|
|
mousefs_random_test$(EXT): $(CFILES) $(HFILES)
|
|
gcc -o $@ $(CFILES) $(CFLAGS) $(LFLAGS) -Iinc -DBUILD_TEST
|
|
|
|
mousefs_random_test_coverage$(EXT): $(CFILES) $(HFILES)
|
|
gcc -o $@ $(CFILES) $(COVERAGE_CFLAGS) $(LFLAGS) $(COVERAGE_LFLAGS) -Iinc -DBUILD_TEST
|
|
|
|
example_client$(EXT): libmousefs.a
|
|
gcc -o $@ examples/main.c $(CFLAGS) -lmousefs $(LFLAGS) -Iinc -L.
|
|
|
|
%.o: %.c $(HFILES)
|
|
gcc -c -o $@ $< $(CFLAGS) -Iinc
|
|
|
|
libmousefs.a: $(OFILES)
|
|
ar rcs $@ $^
|
|
|
|
clean:
|
|
rm -f \
|
|
mousefs.exe \
|
|
mousefs.out \
|
|
mousefs_random_test.exe \
|
|
mousefs_random_test.out \
|
|
mousefs_random_test_coverage.exe \
|
|
mousefs_random_test_coverage.out \
|
|
example_client.exe \
|
|
example_client.out \
|
|
libmousefs.a \
|
|
src/*.o \
|
|
src/*.gcda \
|
|
src/*.gcno \
|
|
*.gcda \
|
|
*.gcno
|