Skip to content

testing: sub fuzz targets #46780

@srikrsna

Description

@srikrsna

It would be nice to be able to define sub fuzz targets like subtests and sub-benchmarks. Example:

for _, fc := range Cases {
    f.Run(fc.Name, func(f *testing.F) {
        f.Add(...)
        f.Fuzz(func(t *testing.T, data []byte) {
            t.Parallel()
            fz := fuzz.NewFromGoFuzz(data).Funcs(exfuzz.FuzzFuncs()...).Funcs(vanguardfz.FuzzFuncs()...)

            *r := fc.r
            fz.Fuzz(&r)

            u := fc.Permissions
            res, det, err := assert[tc.Method].Eval(map[string]interface{}{
                "r": r,
                "u": u,
            })
            // Assertions
        })
    })
}

This would be very much useful to fuzz functions with generic but defined data structures.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureRequestIssues asking for a new feature that does not need a proposal.NeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.fuzzIssues related to native fuzzing support

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions