Skip to content

testing, internal/fuzz: Support -c flag #52169

@AdamKorcz

Description

@AdamKorcz

When building a native fuzzer with the -c flag, a unit test is built.

For example, I have a simple fuzzer:

package fuzz

import (
        "fmt"
        "testing"
)

func Fuzz(f *testing.F) {
        f.Fuzz(func(t *testing.T, data string) {
                fmt.Println(data)
        })
}

I build it with go test -fuzz=Fuzz -c
...which gives me the fuzz.test executable.
Running that executable with ./fuzz.test prints out: PASS

This may be intended, but it would be highly desirable to offer support for building an executable that can be run with the same flags as go test -fuzz=Fuzz.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions