Skip to content

Commit

Permalink
Always log from a fuzz target
Browse files Browse the repository at this point in the history
Fixes #57.
  • Loading branch information
flyingmutant committed Jul 4, 2023
1 parent b1b4705 commit 86ebb4c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func checkFuzz(tb tb, prop func(*T), input []byte) {
input = input[n:]
}

t := newT(tb, newBufBitStream(buf, false), flags.verbose, nil)
t := newT(tb, newBufBitStream(buf, false), true, nil)
err := checkOnce(t, prop)

switch {
Expand Down
23 changes: 20 additions & 3 deletions engine_fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ func checkString(t *T) {
}
}

func checkStuckStateMachine(t *T) {
die := 0
t.Repeat(map[string]func(*T){
"roll": func(t *T) {
if die == 6 {
t.Skip("game over")
}
die = IntRange(1, 6).Draw(t, "die")
},
})
}

func TestRapidInt(t *testing.T) {
t.Skip()
Check(t, checkInt)
Expand All @@ -45,7 +57,12 @@ func TestRapidString(t *testing.T) {
t.Skip()
Check(t, checkString)
}
func TestRapidStuckStateMachine(t *testing.T) {
t.Skip()
Check(t, checkStuckStateMachine)
}

func FuzzInt(f *testing.F) { f.Fuzz(MakeFuzz(checkInt)) }
func FuzzSlice(f *testing.F) { f.Fuzz(MakeFuzz(checkSlice)) }
func FuzzString(f *testing.F) { f.Fuzz(MakeFuzz(checkString)) }
func FuzzInt(f *testing.F) { f.Fuzz(MakeFuzz(checkInt)) }
func FuzzSlice(f *testing.F) { f.Fuzz(MakeFuzz(checkSlice)) }
func FuzzString(f *testing.F) { f.Fuzz(MakeFuzz(checkString)) }
func FuzzStuckStateMachine(f *testing.F) { f.Fuzz(MakeFuzz(checkStuckStateMachine)) }

0 comments on commit 86ebb4c

Please sign in to comment.