Skip to content

testing: enforce the documented restriction on fuzz target result parameters #51222

Closed

Description

@findleyr

The documentation for F.Fuzz states that "ff must be a function with no return value", but in practice this is not enforced. For example, the following invocation is accepted:

func FuzzFoo(f *testing.F) {
	f.Fuzz(func(t *testing.T, i int) int {
		return 0
	})
}

We should enforce the documented restriction. If we don't, users will likely depend on the current behavior. We can always relax this restriction in the future.

Marking as a release blocker as this is an API change.

CC @golang/release @bcmills

Activity

  1. added this to the Go1.18 milestone on Feb 16, 2022
  2. findleyr commented on Feb 16, 2022

    @findleyr
    ContributorAuthor

    (CC @julieqiu as well).

  3. gopherbot commented on Feb 16, 2022

    @gopherbot
    Contributor

    Change https://go.dev/cl/386175 mentions this issue: testing: panic in Fuzz if the function returns a value

  4. self-assigned this
    on Feb 16, 2022
  5. added
    NeedsFixThe path to resolution is known, but the work has not been done.
    on Feb 16, 2022
  6. bcmills commented on Feb 16, 2022

    @bcmills
    Contributor

    Marking as a release blocker as this is an API change.

    Since the API is already documented to require “no return value” it's not technically an API change, but I agree that it should be a release-blocker. (Otherwise, it's too easy for users to accidentally rely on behavior counter to the documentation.)

  7. findleyr commented on Feb 16, 2022

    @findleyr
    ContributorAuthor

    Since the API is already documented to require “no return value” it's not technically an API change

    Indeed, I probably should have said "observable change" :)

  8. changed the title [-]cmd/go: enforce the documented restriction on fuzz target result parameters[/-] [+]testing: enforce the documented restriction on fuzz target result parameters[/+] on Feb 16, 2022
  9. locked and limited conversation to collaborators on Jun 22, 2023
  10. added a commit that references this issue on Apr 29, 2024
    f985833
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions