From 4cde035a720448b2bca07ecdc12beef3b1322939 Mon Sep 17 00:00:00 2001 From: Jay Conrod Date: Fri, 19 Mar 2021 15:11:29 -0400 Subject: [dev.fuzz] internal/fuzz: improve cancellation in worker event loops worker.runFuzzing now accepts a Context, used for cancellation instead of doneC (which is removed). This is passed down through workerClient RPC methods (ping, fuzz). workerClient RPC methods now wrap the call method, which handles marshaling and cancellation. Both workerClient.call and workerServer.serve should return quickly when their contexts are cancelled. Turns out, closing the pipe won't actually unblock a read on all platforms. Instead, we were falling back to SIGKILL in worker.stop, which works but takes longer than necessary. Also fixed missing newline in log message. Change-Id: I7b5ae54d6eb9afd6361a07759f049f048952e0cc Reviewed-on: https://go-review.googlesource.com/c/go/+/303429 Trust: Jay Conrod Trust: Katie Hockman Run-TryBot: Jay Conrod Reviewed-by: Katie Hockman --- src/testing/fuzz.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/testing') diff --git a/src/testing/fuzz.go b/src/testing/fuzz.go index 2a0754fdd7..73ac59cfb4 100644 --- a/src/testing/fuzz.go +++ b/src/testing/fuzz.go @@ -362,7 +362,7 @@ func (f *F) Fuzz(ff interface{}) { if err != nil { f.result = FuzzResult{Error: err} f.Fail() - fmt.Fprintf(f.w, "%v", err) + fmt.Fprintf(f.w, "%v\n", err) if crashErr, ok := err.(fuzzCrashError); ok { crashName := crashErr.CrashName() fmt.Fprintf(f.w, "Crash written to %s\n", filepath.Join("testdata/corpus", f.name, crashName)) -- cgit v1.3