genfuzzfuncs

command
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

README

genfuzzfuncs: generate fuzz functions from user code

genfuzzfuncs is an early stage prototype for automatically generating fuzz functions, similar in spirit to cweill/gotests. It is not intended to be part of the "first class fuzzing" proposal for cmd/go.

For example, if you run genfuzzfuncs against github.com/google/uuid, it generates a uuid_fuzz.go file with 30 or so functions like:

func Fuzz_UUID_MarshalText(u1 uuid.UUID) {
    u1.MarshalText()
}

func Fuzz_UUID_UnmarshalText(u1 *uuid.UUID, data []byte) {
    if u1 == nil {
	    return
    }
    u1.UnmarshalText(data)
}

You can then edit or delete as desired, and then fuzz using the rich signature fuzzing support in thepudds/fzgo, such as:

fzgo test -fuzz=. ./...

Documentation

Overview

genfuzzfuncs is an early stage prototype for automatically generating fuzz functions, similar in spirit to cweill/gotests.

For example, if you run genfuzzfuncs against github.com/google/uuid, it generates a uuid_fuzz.go file with 30 or so functions like:

  func Fuzz_UUID_MarshalText(u1 uuid.UUID) {
	   u1.MarshalText()
  }

  func Fuzz_UUID_UnmarshalText(u1 *uuid.UUID, data []byte) {
	   if u1 == nil {
		 return
	   }
	   u1.UnmarshalText(data)
  }

You can then edit or delete indivdual fuzz funcs as desired, and then fuzz using the rich signature fuzzing support in thepudds/fzgo, such as:

fzgo test -fuzz=. ./...

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL