ci(fuzz): add make fuzz target and a fuzz workflow on main
- commit
- bb30cc003c4689fcc917ccb590b7b297184bf1e5
- author
- brice · · 2026-10-22 10:36 UTC
- parent
- ad1316e
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
2 files · +26 -1
A .github/workflows/fuzz.yml +17 -0
| @@ -0,0 +1,17 @@ | |||
| 1 | + | name: fuzz | |
| 2 | + | on: | |
| 3 | + | push: | |
| 4 | + | branches: [main] | |
| 5 | + | workflow_dispatch: | |
| 6 | + | permissions: | |
| 7 | + | contents: read | |
| 8 | + | jobs: | |
| 9 | + | fuzz: | |
| 10 | + | runs-on: ubuntu-latest | |
| 11 | + | timeout-minutes: 60 | |
| 12 | + | steps: | |
| 13 | + | - uses: actions/checkout@v4 | |
| 14 | + | - uses: actions/setup-go@v5 | |
| 15 | + | with: | |
| 16 | + | go-version-file: go.mod | |
| 17 | + | - run: make fuzz FUZZTIME=60s | |
| @@ -0,0 +1,17 @@ | |||||
| 1 | + | name: fuzz | |||
| 2 | + | on: | |||
| 3 | + | push: | |||
| 4 | + | branches: [main] | |||
| 5 | + | workflow_dispatch: | |||
| 6 | + | permissions: | |||
| 7 | + | contents: read | |||
| 8 | + | jobs: | |||
| 9 | + | fuzz: | |||
| 10 | + | runs-on: ubuntu-latest | |||
| 11 | + | timeout-minutes: 60 | |||
| 12 | + | steps: | |||
| 13 | + | - uses: actions/checkout@v4 | |||
| 14 | + | - uses: actions/setup-go@v5 | |||
| 15 | + | with: | |||
| 16 | + | go-version-file: go.mod | |||
| 17 | + | - run: make fuzz FUZZTIME=60s | |||
M Makefile +9 -1
| @@ -1,7 +1,8 @@ | |||
| 1 | 1 | export CGO_ENABLED := 0 | |
| 2 | 2 | STATICCHECK ?= staticcheck | |
| 3 | + | FUZZTIME ?= 60s | |
| 3 | 4 | ||
| 4 | - | .PHONY: gen gen-check test race alloc poison bench xserver staticcheck vet check | |
| 5 | + | .PHONY: gen gen-check test race alloc poison bench fuzz xserver staticcheck vet check | |
| 5 | 6 | ||
| 6 | 7 | gen: | |
| 7 | 8 | go generate ./... | |
| @@ -18,6 +19,13 @@ poison: | |||
| 18 | 19 | go test -tags xturbo_poison ./... | |
| 19 | 20 | bench: | |
| 20 | 21 | go test -bench . -benchmem ./... | |
| 22 | + | fuzz: | |
| 23 | + | @set -e; for pkg in $$(go list ./...); do \ | |
| 24 | + | for t in $$(go test -list 'Fuzz.*' $$pkg | grep '^Fuzz'); do \ | |
| 25 | + | echo "== $$pkg $$t ($(FUZZTIME))"; \ | |
| 26 | + | go test -run '^$$' -fuzz "^$$t$$" -fuzztime $(FUZZTIME) $$pkg; \ | |
| 27 | + | done; \ | |
| 28 | + | done | |
| 21 | 29 | xserver: | |
| 22 | 30 | PATH="$$PATH:/usr/sbin" go test -tags xserver ./... | |
| 23 | 31 | staticcheck: | |
| @@ -1,7 +1,8 @@ | |||||
| 1 | export CGO_ENABLED := 0 | 1 | export CGO_ENABLED := 0 | ||
| 2 | STATICCHECK ?= staticcheck | 2 | STATICCHECK ?= staticcheck | ||
| 3 | + | FUZZTIME ?= 60s | |||
| 3 | 4 | ||||
| 4 | - | .PHONY: gen gen-check test race alloc poison bench xserver staticcheck vet check | 5 | + | .PHONY: gen gen-check test race alloc poison bench fuzz xserver staticcheck vet check |
| 5 | 6 | ||||
| 6 | gen: | 7 | gen: | ||
| 7 | go generate ./... | 8 | go generate ./... | ||
| @@ -18,6 +19,13 @@ poison: | |||||
| 18 | go test -tags xturbo_poison ./... | 19 | go test -tags xturbo_poison ./... | ||
| 19 | bench: | 20 | bench: | ||
| 20 | go test -bench . -benchmem ./... | 21 | go test -bench . -benchmem ./... | ||
| 22 | + | fuzz: | |||
| 23 | + | @set -e; for pkg in $$(go list ./...); do \ | |||
| 24 | + | for t in $$(go test -list 'Fuzz.*' $$pkg | grep '^Fuzz'); do \ | |||
| 25 | + | echo "== $$pkg $$t ($(FUZZTIME))"; \ | |||
| 26 | + | go test -run '^$$' -fuzz "^$$t$$" -fuzztime $(FUZZTIME) $$pkg; \ | |||
| 27 | + | done; \ | |||
| 28 | + | done | |||
| 21 | xserver: | 29 | xserver: | ||
| 22 | PATH="$$PATH:/usr/sbin" go test -tags xserver ./... | 30 | PATH="$$PATH:/usr/sbin" go test -tags xserver ./... | ||
| 23 | staticcheck: | 31 | staticcheck: | ||