Skip to content

Commit 3e8744f

Browse files
Ignore testing.runFuzzing and testing.runFuzzTests (#105)
When Fuzz testing, if the `-fuzz` flag is used then the fuzzing engine is used to generate test cases out of the seed corpus, this causes `testing.runFuzzTests` to be blocked until a failing input is found or there is a signal to stop generating. On the other hand `testing.runFuzzTests` is called even without the use of the `-fuzz` flag, executes the input testing with all the elements in the seed corpus and it's blocked until every test has run. On both cases, goleak detects them as leaking goroutines, but this are expected goroutines. Internal Ref: GO-2002 Fix #104
1 parent 4a14d38 commit 3e8744f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

options.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,12 @@ func isTestStack(s stack.Stack) bool {
181181
// Since go1.7, a separate goroutine is started to wait for signals.
182182
// T.Parallel is for parallel tests, which are blocked until all serial
183183
// tests have run with T.Parallel at the top of the stack.
184+
// testing.runFuzzTests is for fuzz testing, it's blocked until the test
185+
// function with all seed corpus have run.
186+
// testing.runFuzzing is for fuzz testing, it's blocked until a failing
187+
// input is found.
184188
switch s.FirstFunction() {
185-
case "testing.RunTests", "testing.(*T).Run", "testing.(*T).Parallel":
189+
case "testing.RunTests", "testing.(*T).Run", "testing.(*T).Parallel", "testing.runFuzzing", "testing.runFuzzTests":
186190
// In pre1.7 and post-1.7, background goroutines started by the testing
187191
// package are blocked waiting on a channel.
188192
return strings.HasPrefix(s.State(), "chan receive")

0 commit comments

Comments
 (0)