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

proposal: testing: add (*testing.F).AddNamed() for naming seed corpus entries #70070

Open
mateusz834 opened this issue Oct 27, 2024 · 3 comments
Labels
Milestone

Comments

@mateusz834
Copy link
Member

Proposal Details

Currently the corpus entries ("sub-tests") added by (*testing.F).Add() are named like: FuzzMyFuzz/seed#0. In my case i am populating the fuzz corpus with file contents from the testdata directory, because of the default naming there is no easy way to quickly map seed corpus to a file (for -run, to run only one test from the corpus), to do so i need to t.Log the file contents in the f.Fuzz and figure out which file contains that data, this is annoying, especially that while adding a corpus entry the file name is known.

I propose to add following function to the testing package to solve this issue:

// AddNamed will add the arguments to the seed corpus for the fuzz test with a specified name.
// This will be a no-op if called after or within the fuzz target, and args must match the
// arguments for the fuzz target.
func (f *F) AddNamed(name string, args ...any)
@gopherbot gopherbot added this to the Proposal milestone Oct 27, 2024
@gabyhelp
Copy link

Related Issues and Documentation

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

@mateusz834
Copy link
Member Author

This is relevant #50456 (TLDR: Add should behave as the AddNamed proposed here, not possible now because of breaking API changes)

It sounds like this is either a likely decline or a 'on hold'. Given that we are not making changes for Go 1.18, perhaps it should be declined for now, and then a new proposal with a different API can be proposed if we need it?

@ianlancetaylor ianlancetaylor moved this to Incoming in Proposals Oct 28, 2024
@ianlancetaylor
Copy link
Contributor

CC @golang/fuzzing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Incoming
Development

No branches or pull requests

4 participants