aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-21 02:00:20 -0400
committerCraig Jennings <c@cjennings.net>2026-06-21 02:00:20 -0400
commit6b2fd20dfc6e2cba418d27c0955908db8ec19039 (patch)
tree2339c6cd32fceb01f8709221686a312db33cd764 /Makefile
parentbdd3fc2bd57cd016c8cb701911660d9f09192daf (diff)
downloademacs-wttrin-6b2fd20dfc6e2cba418d27c0955908db8ec19039.tar.gz
emacs-wttrin-6b2fd20dfc6e2cba418d27c0955908db8ec19039.zip
test: add make coverage-summary with untested-module detection
A module no test loads never appears in undercover's report, so a line-weighted total silently skips it. The coverage-summary target counts such a file as 0% and weights the project number by file, so untested modules stay visible. I replaced scripts/coverage-summary.py, which only summarized files already in the report. make coverage now chains the summary, and CI prints it in the coverage step instead of a separate python call. The helper runs on stock Emacs (built-in json and seq), so it needs no dev deps. It lives in tracked scripts/ so CI can reach it.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile18
1 files changed, 17 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index f80a494..88153c1 100644
--- a/Makefile
+++ b/Makefile
@@ -46,6 +46,10 @@ TEST_UTIL_FILES = $(wildcard $(TEST_DIR)/testutil-*.el)
# Coverage configuration
COVERAGE_DIR = .coverage
COVERAGE_FILE = $(COVERAGE_DIR)/simplecov.json
+# Whole-project summary: prints per-file coverage plus source files absent from
+# the report (modules no test loaded) counted as 0%. Self-contained, stock Emacs.
+COVERAGE_SUMMARY = scripts/coverage-summary.el
+COVERAGE_SOURCE_DIR = .
# Plain emacs invocation (no package archives, used for parens-check)
EMACS_BATCH = $(EMACS) --batch --no-site-file --no-site-lisp
@@ -55,7 +59,7 @@ EASK_EMACS = $(EMACS_ENV) $(EASK) emacs --batch -q -L $(PROJECT_ROOT) -L $(TEST_
.PHONY: help test test-all test-smoke test-unit test-integration test-file test-name \
deps install-deps validate-parens validate compile lint \
- coverage coverage-clean \
+ coverage coverage-summary coverage-clean \
clean clean-compiled clean-tests
# Default target
@@ -74,6 +78,7 @@ help:
@echo ""
@echo " Coverage:"
@echo " make coverage - Generate simplecov JSON at $(COVERAGE_FILE)"
+ @echo " make coverage-summary - Print per-file + whole-project summary (untested modules at 0%)"
@echo " make coverage-clean - Delete the coverage report file"
@echo ""
@echo " Validation:"
@@ -231,6 +236,17 @@ coverage: coverage-clean $(COVERAGE_DIR)
echo "[!] No coverage file produced; check that undercover is installed"; \
exit 1; \
fi
+ @$(MAKE) coverage-summary
+
+# Whole-project summary. Stock Emacs only (no Eask deps) — the script needs just
+# the built-in `json' and `seq'. Counts a source file with no report entry as 0%.
+coverage-summary:
+ @if [ ! -f $(COVERAGE_FILE) ]; then \
+ echo "[!] No coverage report at $(COVERAGE_FILE). Run 'make coverage' first."; \
+ exit 1; \
+ fi
+ @$(EMACS) --batch -q -l $(COVERAGE_SUMMARY) \
+ --eval '(cj/coverage-print-module-summary "$(COVERAGE_FILE)" "$(COVERAGE_SOURCE_DIR)" "$(CURDIR)")'
coverage-clean:
@rm -f $(COVERAGE_FILE)