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

gen: make "." the default constructor regex pattern and improve emitted comments #16

Merged
merged 6 commits into from
Jan 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions examples/outputs/arg-reuse/autofuzzchain_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package argexamplefuzz // rename if needed
package argexamplefuzz

// Edit if desired. Code generated by "fzgen -chain github.com/thepudds/fzgen/examples/inputs/arg-reuse".

// if needed, fill in imports or run 'goimports'
import (
"testing"

Expand All @@ -17,19 +18,21 @@ func Fuzz_New_Chain(f *testing.F) {
target := argexample.New(i)

steps := []fuzzer.Step{
fuzzer.Step{
{
Name: "Fuzz_PanicOnArgReuse_Step1",
Func: func(a int64, b int64) {
target.Step1(a, b)
}},
fuzzer.Step{
},
},
{
Name: "Fuzz_PanicOnArgReuse_Step2",
Func: func(a int64, b int64) {
target.Step2(a, b)
}},
},
},
}

// Execute a specific chain of steps, with the count, sequence and arguments controlled by fz.Chain
fz.Chain(steps, nil)
fz.Chain(steps)
})
}
9 changes: 1 addition & 8 deletions examples/outputs/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,18 @@ go 1.18
replace (
github.com/thepudds/fzgen => ./../..
github.com/thepudds/fzgen/examples/inputs/race-xsync-map => ./../../examples/inputs/race-xsync-map
github.com/thepudds/fzgen/examples/inputs/race-xsync-mpmcqueue => ./../../examples/inputs/race-xsync-mpmcqueue
)

require (
github.com/RoaringBitmap/roaring v0.9.4
github.com/google/uuid v1.3.0
github.com/thepudds/fzgen v0.0.0-00010101000000-000000000000
github.com/thepudds/fzgen/examples/inputs/race-xsync-map v0.0.0-00010101000000-000000000000
github.com/thepudds/fzgen/examples/inputs/race-xsync-mpmcqueue v0.0.0-00010101000000-000000000000
golang.zx2c4.com/go118/netip v0.0.0-20211111135330-a4a02eeacf9d
inet.af/netaddr v0.0.0-20211027220019-c74959edd3b6
)

require (
github.com/RoaringBitmap/roaring v0.9.4 // indirect
github.com/bits-and-blooms/bitset v1.2.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/mschoch/smat v0.2.0 // indirect
github.com/puzpuzpuz/xsync v1.0.1-0.20210823092703-32778049b5f5 // indirect
github.com/sanity-io/litter v1.5.1 // indirect
go4.org/intern v0.0.0-20211027215823-ae77deb06f29 // indirect
go4.org/unsafe/assume-no-moving-gc v0.0.0-20211027215541-db492cf91b37 // indirect
)
40 changes: 4 additions & 36 deletions examples/outputs/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,24 @@ github.com/RoaringBitmap/roaring v0.9.4/go.mod h1:icnadbWcNyfEHlYdr+tDlOTih1Bf/h
github.com/bits-and-blooms/bitset v1.2.0 h1:Kn4yilvwNtMACtf1eYDlG8H77R07mZSPbMjLyS07ChA=
github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/dvyukov/go-fuzz v0.0.0-20210103155950-6a8e9d1f2415/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/mschoch/smat v0.2.0 h1:8imxQsjDm8yFEAVBe7azKmKSgzSkZXDuKkSq9374khM=
github.com/mschoch/smat v0.2.0/go.mod h1:kc9mz7DoBKqDyiRL7VZN8KvXQMWeTaVnttLRXOlotKw=
github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0 h1:GD+A8+e+wFkqje55/2fOVnZPkoDIu1VooBWfNrnY8Uo=
github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/puzpuzpuz/xsync v1.0.1-0.20210823092703-32778049b5f5 h1:ZoUoiy+1+jwi9B2+5F0Mh4HMlI/q01Nqt+qN9T2h5lA=
github.com/puzpuzpuz/xsync v1.0.1-0.20210823092703-32778049b5f5/go.mod h1:GF6mnc4fZ1Vit0eWBHPcthv2l1nE81+iZvLsexB/HM4=
github.com/sanity-io/litter v1.5.1 h1:dwnrSypP6q56o3lFxTU+t2fwQ9A+U5qrXVO4Qg9KwVU=
github.com/sanity-io/litter v1.5.1/go.mod h1:5Z71SvaYy5kcGtyglXOC9rrUi3c1E8CamFWjQsazTh0=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v0.0.0-20161117074351-18a02ba4a312 h1:UsFdQ3ZmlzS0BqZYGxvYaXvFGUbCmPGy8DM7qWJJiIQ=
github.com/stretchr/testify v0.0.0-20161117074351-18a02ba4a312/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go4.org/intern v0.0.0-20211027215823-ae77deb06f29 h1:UXLjNohABv4S58tHmeuIZDO6e3mHpW2Dx33gaNt03LE=
go4.org/intern v0.0.0-20211027215823-ae77deb06f29/go.mod h1:cS2ma+47FKrLPdXFpr7CuxiTW3eyJbWew4qx0qtQWDA=
go4.org/unsafe/assume-no-moving-gc v0.0.0-20211027215541-db492cf91b37 h1:Tx9kY6yUkLge/pFG7IEMwDZy6CS2ajFc9TvQdPCW0uA=
go4.org/unsafe/assume-no-moving-gc v0.0.0-20211027215541-db492cf91b37/go.mod h1:FftLjUGFEDu5k8lt0ddY+HcrH/qU/0qk+H8j9/nTl3E=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.zx2c4.com/go118/netip v0.0.0-20211111135330-a4a02eeacf9d h1:9+v0G0naRhLPOJEeJOL6NuXTtAHHwmkyZlgQJ0XcQ8I=
golang.zx2c4.com/go118/netip v0.0.0-20211111135330-a4a02eeacf9d/go.mod h1:5yyfuiqVIJ7t+3MqrpTQ+QqRkMWiESiyDvPNvKYCecg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
inet.af/netaddr v0.0.0-20211027220019-c74959edd3b6 h1:acCzuUSQ79tGsM/O50VRFySfMm19IoMKL+sZztZkCxw=
inet.af/netaddr v0.0.0-20211027220019-c74959edd3b6/go.mod h1:y3MGhcFMlh0KZPMuXXow8mpjxxAk3yoDNsp4cQz54i8=
5 changes: 3 additions & 2 deletions examples/outputs/google-uuid/autofuzz_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package uuidfuzz // rename if needed
package uuidfuzz

// Edit if desired. Code generated by "fzgen -ctor=^FromBytes$ github.com/google/uuid".

// if needed, fill in imports or run 'goimports'
import (
"io"
"testing"
Expand Down
6 changes: 3 additions & 3 deletions examples/outputs/google-uuid/autofuzzchain_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package uuidfuzz

// Edit if desired. Code generated by "fzgen -chain -ctor=^FromBytes$ github.com/google/uuid".

import (
"database/sql/driver"
"fmt"
Expand All @@ -10,9 +12,6 @@ import (
"github.com/thepudds/fzgen/fuzzer"
)

// Automatically generated via:
// fzgen -chain -ctor=FromBytes github.com/google/uuid

func Fuzz_FromBytes_Chain(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
var b []byte
Expand All @@ -26,6 +25,7 @@ func Fuzz_FromBytes_Chain(f *testing.F) {

steps := []fuzzer.Step{
// skipping Fuzz_UUID_Scan because parameters include unsupported interface: interface{}

{
Name: "Fuzz_UUID_UnmarshalBinary",
Func: func(d1 []byte) {
Expand Down
5 changes: 2 additions & 3 deletions examples/outputs/race-xsync-map/autofuzzchain_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package xsyncmapfuzz

// generated via:
// fzgen -chain -parallel github.com/thepudds/fzgen/examples/inputs/race-xsyncmap
// Edit if desired. Code generated by "fzgen -chain -parallel github.com/thepudds/fzgen/examples/inputs/race-xsync-map".

import (
"testing"
Expand Down Expand Up @@ -52,6 +51,6 @@ func Fuzz_NewXSyncMap_Chain(f *testing.F) {
}

// Execute a specific chain of steps, with the count, sequence and arguments controlled by fz.Chain
fz.Chain(steps, fuzzer.ChainOptParallel)
fz.Chain(steps, fuzzer.ChainParallel)
})
}
3 changes: 1 addition & 2 deletions examples/outputs/race/autofuzzchain_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package raceexamplefuzz

// Automatically generated by:
// fzgen -chain -parallel github.com/thepudds/fzgen/examples/inputs/race
// Edit if desired. Code generated by "fzgen -chain -parallel github.com/thepudds/fzgen/examples/inputs/race".

import (
"testing"
Expand Down
Loading