aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 19:29:27 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 19:29:27 +0200
commite94e107071223b2504963dfa95ccd1f2293da752 (patch)
tree392e119d5f03e68e15c395e9db8732e95bc69983 /Makefile
parente64f162bffa6ced845bac4d3015954c41c4b4a3e (diff)
downloadkrino-e94e107071223b2504963dfa95ccd1f2293da752.tar.gz
krino-e94e107071223b2504963dfa95ccd1f2293da752.zip
plan 8: threat model, make fuzz, race and vulncheck
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile22
1 files changed, 21 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 62e2b7e..e09a3be 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@ VERSION != git describe --tags --always --dirty 2>/dev/null || echo dev
LDFLAGS = -s -w -X main.version=$(VERSION)
CROSS_PLATFORMS = linux/amd64 linux/arm64 freebsd/amd64 openbsd/amd64
-.PHONY: all help build install uninstall test vet fmt lint ci bench cross dist release deps install-hooks clean
+.PHONY: all help build install uninstall test vet fmt lint ci bench fuzz race vulncheck cross dist release deps install-hooks clean
all: build
@@ -79,6 +79,26 @@ ci: ## the gate: gofmt, vet, tests, dependencies, no personal data staged, man p
bench: ## run the Go benchmarks on generated trees
go test -run '^$$' -bench . -benchmem ./...
+# FUZZ_TARGETS lists every fuzz target as package-directory:FuzzName.
+FUZZTIME ?= 20s
+FUZZ_TARGETS = \
+ internal/sexp:FuzzParse
+
+fuzz: ## run every fuzz target for FUZZTIME each (default 20s); a crasher is saved under testdata/fuzz
+ @for t in $(FUZZ_TARGETS); do \
+ pkg=$${t%%:*}; name=$${t##*:}; \
+ echo "fuzz $$pkg $$name ($(FUZZTIME))"; \
+ go test -run '^$$' -fuzz "^$$name$$" -fuzztime $(FUZZTIME) ./$$pkg || exit 1; \
+ done
+
+race: ## run the tests under the race detector (needs cgo and a C compiler)
+ CGO_ENABLED=1 go test -race ./...
+
+# govulncheck v1.1.4 is the newest release that builds with Go 1.24
+# (v1.2.0 and later need Go 1.25); GOTOOLCHAIN=local stops a toolchain download.
+vulncheck: ## check the standard library and dependencies against the Go vulnerability database (network)
+ GOTOOLCHAIN=local go run golang.org/x/vuln/cmd/govulncheck@v1.1.4 ./...
+
cross: ## cross-compile linux/amd64, linux/arm64, freebsd/amd64, openbsd/amd64 into dist/krino-$(VERSION)-<os>-<arch>/
@case '$(VERSION)' in \
''|*[!A-Za-z0-9._+-]*) \