Last active
September 11, 2025 12:11
-
-
Save Integralist/9fc9853ca099ff9164ab63388d461784 to your computer and use it in GitHub Desktop.
Go Fuzz Testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: test-fuzz | |
test-fuzz: ## Run fuzz tests | |
ifeq ($(strip $(GO_FUZZARGS)),) | |
@status=0; \ | |
for pkg in $$(go list ./...); do \ | |
for test in $$(go test -list=^Fuzz $$pkg | grep '^Fuzz'); do \ | |
echo ">>> Fuzzing $$pkg $$test"; \ | |
if ! go test -fuzz=$$test -fuzztime=10s $$pkg; then \ | |
echo "❌ FAIL: $$pkg $$test"; \ | |
status=1; \ | |
fi; \ | |
done; \ | |
done; \ | |
exit $$status | |
else | |
@# Running tests with fuzz arguments | |
go test -v -run='^$$' $(GO_FUZZARGS) | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment