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

testing: use T.Skip to mark a fuzz input as uninteresting #48299

Closed
jayconrod opened this issue Sep 9, 2021 · 1 comment
Closed

testing: use T.Skip to mark a fuzz input as uninteresting #48299

jayconrod opened this issue Sep 9, 2021 · 1 comment
Labels
FeatureRequest FrozenDueToAge fuzz Issues related to native fuzzing support NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@jayconrod
Copy link
Contributor

Currently, the fuzzing engine marks an input as "interesting" if it activates coverage counters that were not activated before. Interesting inputs are minimized and added to the cached corpus. New inputs may be derived from them.

Fuzz target authors may not want to spend time fuzzing certain kinds of inputs, for example, because they're unlikely to find bugs or because they're expensive or impractical to test. It would be useful to have some signal that an input is not interesting and should not be added to the cached corpus. T.Skip seems like a reasonable way to do that.

func FuzzSqrt(f *testing.T) {
  f.Add(2.0)
  f.Add(99.9)
  f.Fuzz(func(t *testing.T, v float64) {
    if v < 0 {
      t.Skip()
    }
    s := math.Sqrt(v)
    if math.Abs(s*s - v) >= 0.001 {
      t.Fatal()
    }
  })
}

Compare with go-fuzz, which has a similar feature: the fuzz function may return:

  • +1 for an interesting input that should be given priority (we have no way to express this yet)
  • 0 normally
  • -1 for an input that should not be added to the corpus, even if it exposes new coverage (this feature)
@jayconrod jayconrod added FeatureRequest fuzz Issues related to native fuzzing support labels Sep 9, 2021
@jayconrod jayconrod added this to the Backlog milestone Sep 9, 2021
@cagedmantis cagedmantis added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 13, 2021
@rsc rsc changed the title [dev.fuzz] testing: use T.Skip to mark an input as uninteresting testing: use T.Skip to mark a fuzz input as uninteresting Sep 21, 2021
@katiehockman
Copy link
Contributor

Closing as a duplicate of #48779

@golang golang locked and limited conversation to collaborators Feb 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FeatureRequest FrozenDueToAge fuzz Issues related to native fuzzing support NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
Status: No status
Development

No branches or pull requests

4 participants