diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -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._+-]*) \ |
