https://github.com/koonix/gofuzz
gofuzz runs Golang fuzz tests in parallel.
https://github.com/koonix/gofuzz
Last synced: 11 months ago
JSON representation
gofuzz runs Golang fuzz tests in parallel.
- Host: GitHub
- URL: https://github.com/koonix/gofuzz
- Owner: koonix
- License: mit
- Created: 2024-09-07T16:41:57.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-13T18:21:48.000Z (over 1 year ago)
- Last Synced: 2024-12-13T19:18:21.069Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 33.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gofuzz
Unlike regular tests,
only a single fuzz test can be executed using the Go command.
gofuzz allows running multiple or all fuzz tests in a project
back to back or in parallel.
## Install
```sh
go install github.com/koonix/gofuzz@latest
```
## Usage
Usage is similar to running regular tests.
To run fuzz tests of pkg1 and pkg2:
```sh
gofuzz ./pkg1 ./dir/pkg2
```
To run all fuzz tests in the project:
```sh
gofuzz ./...
```
To pass arguments to `go test`, put them after a `--`:
```sh
gofuzz ./... -- -fuzztime=10s
```
To configure which fuzz tests to run and the number of tests running in parallel:
```sh
gofuzz -run='FuzzFunc1|FuzzFunc2' -parallel=5 ./... -- -fuzztime=10s
```
Use in GitHub Actions:
```yaml
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
- name: Run tests
run: go test -v ./...
- name: Run fuzz tests
run: go run github.com/koonix/gofuzz@latest ./... -- -fuzztime=30s
```
Full usage:
```
Usage: gofuzz [OPTIONS...] [PACKAGES...] [-- GOTESTARGS...]
gofuzz runs multiple Go fuzz tests.
PACKAGES are package patterns, as accepted by the go test command.
GOTESTARGS are extra args passed to the go test command.
Options:
-C string
run as if the program was started in this path (default ".")
-gotest string
command used for running tests, as whitespace-separated args (default "go test")
-parallel int
maximum number of fuzz tests to run simultaneously (default 1)
-run string
run only those fuzz tests matching the regular expression (default ".")
```