Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: better fuzzing documentation #57247

Closed
soypat opened this issue Dec 11, 2022 · 2 comments
Closed

cmd/go: better fuzzing documentation #57247

soypat opened this issue Dec 11, 2022 · 2 comments

Comments

@soypat
Copy link

soypat commented Dec 11, 2022

The documentation was pretty sparse on fuzzing.

First I had a tough time finding where my corpus was because no testdata dir was being generated- so I though "aha, must be an environment variable, something like GOFUZZCORPUS, but. nothing.

Then I started looking in go help test, took me a while to skim though and find that I needed to check out go help testfunc for more details only to find there was barely anything on fuzzing.

Relevant go help test output:

These additional files can contain test functions, benchmark functions, fuzz
tests and example functions. See 'go help testfunc' for more.

Relevant go help testfunc output:

A fuzz test is one named FuzzXxx and should have the signature,

	func FuzzXxx(f *testing.F) { ... }
// ...
The entire test file is presented as the example when it contains a single
example function, at least one other function, type, variable, or constant
declaration, and no tests, benchmarks, or fuzz tests.

There is no way to make out how the fuzzing command works from this. Please add better documentation of:

  • Where the non-crashign fuzz corpus is located (GOCACHE)
  • Where the crashing corpus is located
  • What the differences are between both
  • Fuzzing by default goes on forever
  • How to add non crashing fuzz corpus to unit tests
@soypat soypat changed the title go command: better fuzzing documentation cmd/go: better fuzzing documentation Dec 11, 2022
@soypat
Copy link
Author

soypat commented Dec 11, 2022

Maybe worth adding go help testfuzz?

@seankhliao
Copy link
Member

I believe these already exist in the package docs for testing and the linked https://go.dev/security/fuzz/

@golang golang locked and limited conversation to collaborators Dec 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants