Skip to content

Commit e09389d

Browse files
committed
add report
1 parent db31422 commit e09389d

2 files changed

Lines changed: 29 additions & 8 deletions

File tree

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ fuzz_crash:
4545
fuzz_clean:
4646
@cd fuzzing && $(MAKE) fuzz_clean
4747

48+
fuzz_report:
49+
@cd fuzzing && $(MAKE) fuzz_report
50+
51+
fuzz_report_html:
52+
@cd fuzzing && $(MAKE) fuzz_report_html
53+
4854
fuzz_help:
4955
@echo "Fuzzing targets for ledger-zxlib:"
5056
@echo ""

fuzzing/Makefile

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,21 +104,36 @@ fuzz_report:
104104
fi; \
105105
done
106106

107-
# Generate HTML coverage report
107+
# Generate unified HTML coverage report for all fuzzers
108108
.PHONY: fuzz_report_html
109109
fuzz_report_html:
110+
@# Check coverage directory exists and has data
110111
@if [ ! -d "$(FUZZ_COVERAGE_DIR)" ] || [ -z "$$(ls -A $(FUZZ_COVERAGE_DIR) 2>/dev/null)" ]; then \
111112
echo "Error: Coverage directory is empty. Please run the fuzzer with ENABLE_COVERAGE flag ON"; \
112113
exit 1; \
113114
fi
115+
@# Merge all profraw files into a single profdata file
114116
@llvm-profdata merge -sparse $(FUZZ_COVERAGE_DIR)/*.profraw -o $(FUZZ_COVERAGE_DIR)/coverage.profdata
115-
@for fuzzer in $(FUZZ_BUILD_DIR)/fuzz-*; do \
116-
if [ -x "$$fuzzer" ]; then \
117-
llvm-cov show $$fuzzer -instr-profile=$(FUZZ_COVERAGE_DIR)/coverage.profdata \
118-
-format=html -output-dir=$(FUZZ_COVERAGE_DIR)/report_html_$$(basename $$fuzzer); \
119-
fi; \
120-
done
121-
@echo "HTML coverage reports generated in $(FUZZ_COVERAGE_DIR)/report_html_*"
117+
@echo "Generating unified coverage report for all fuzzers..."
118+
@rm -rf $(FUZZ_COVERAGE_DIR)/report_html_unified
119+
@# Generate HTML report with all fuzzer binaries
120+
@llvm-cov show \
121+
$(FUZZ_BUILD_DIR)/fuzz-base58 \
122+
-object $(FUZZ_BUILD_DIR)/fuzz-base64 \
123+
-object $(FUZZ_BUILD_DIR)/fuzz-bech32 \
124+
-object $(FUZZ_BUILD_DIR)/fuzz-hexutils \
125+
-object $(FUZZ_BUILD_DIR)/fuzz-segwit_addr \
126+
-instr-profile=$(FUZZ_COVERAGE_DIR)/coverage.profdata \
127+
-format=html \
128+
-output-dir=$(FUZZ_COVERAGE_DIR)/report_html_unified \
129+
-show-line-counts-or-regions \
130+
-show-instantiations \
131+
-show-expansions
132+
@echo "Unified HTML coverage report generated in $(FUZZ_COVERAGE_DIR)/report_html_unified"
133+
@# Open report in default browser (cross-platform)
134+
@open $(FUZZ_COVERAGE_DIR)/report_html_unified/index.html 2>/dev/null || \
135+
xdg-open $(FUZZ_COVERAGE_DIR)/report_html_unified/index.html 2>/dev/null || \
136+
echo "Please open manually: $(FUZZ_COVERAGE_DIR)/report_html_unified/index.html"
122137

123138
# === PYTHON FORMATTING TARGETS ===
124139

0 commit comments

Comments
 (0)