encore icon indicating copy to clipboard operation
encore copied to clipboard

Error when fuzzing using `encore test`

Open melkstam opened this issue 3 years ago • 1 comments
trafficstars

When trying to run fuzzing, I seem to get an error when using encore test, but not for using go test. See example below:

// foo.go
package foo

func Baz(a string) string {
  return a
}
// foo_test.go
package foo

import "testing"

func FuzzBaz(f *testing.F) {
  f.Add("example")

  f.Fuzz(func(t *testing.T, a string) {
    b := Baz(a)

    if a != b {
      t.Errorf("%s != %s but should be", a, b)
    }
  })
}

This works fine:

$ go test -fuzz=FuzzBaz          
fuzz: elapsed: 0s, gathering baseline coverage: 0/1 completed
fuzz: elapsed: 0s, gathering baseline coverage: 1/1 completed, now fuzzing with 8 workers
fuzz: elapsed: 3s, execs: 407896 (135956/sec), new interesting: 0 (total: 1)
^Cfuzz: elapsed: 5s, execs: 641895 (138634/sec), new interesting: 0 (total: 1)
PASS
ok      path/to/package/foo    4.849s

While this do not:

$ encore test -fuzz=FuzzBaz  
fuzz: elapsed: 0s, gathering baseline coverage: 0/1 completed
fuzz: elapsed: 0s, gathering baseline coverage: 0/1 completed
--- FAIL: FuzzBaz (0.05s)
    fuzzing process terminated without fuzzing: EOF
FAIL
exit status 1
FAIL    path/to/package/foo    0.753s
exit status 1

melkstam avatar Aug 23 '22 20:08 melkstam

Interesting, that should work. Will have a look.

eandre avatar Aug 23 '22 21:08 eandre