aboutsummaryrefslogtreecommitdiff
path: root/src/testing/sub_test.go
diff options
context:
space:
mode:
authorJay Conrod <jayconrod@google.com>2021-03-10 11:11:59 -0500
committerJay Conrod <jayconrod@google.com>2021-04-09 19:52:06 +0000
commitb2b6be71f27ef74510394dad822cfe8d5e56f4f4 (patch)
tree1ca904318f643304e26fd38ce1afdf551de15729 /src/testing/sub_test.go
parent4baa39ca22c34d4c224ac69da644c85dee196474 (diff)
downloadgo-b2b6be71f27ef74510394dad822cfe8d5e56f4f4.tar.xz
[dev.fuzz] testing: support T.Parallel in fuzz functions
While running the seed corpus, T.Parallel acts like it does in subtests started with T.Run: it blocks until all other non-parallel subtests have finished, then unblocks when the barrier chan is closed. A semaphore (t.context.waitParallel) limits the number of tests that run concurrently (determined by -test.parallel). While fuzzing, T.Parallel has no effect, other than asserting that it can't be called multiple times. We already run different inputs in concurrent processes, but we can't run inputs concurrently in the same process if we want to attribute crashes to specific inputs. Change-Id: I2bac08e647e1d92ea410c83c3f3558a033fe3dd1 Reviewed-on: https://go-review.googlesource.com/c/go/+/300449 Trust: Jay Conrod <jayconrod@google.com> Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org>
Diffstat (limited to 'src/testing/sub_test.go')
-rw-r--r--src/testing/sub_test.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/testing/sub_test.go b/src/testing/sub_test.go
index d2b966dcf9..2d9e145a73 100644
--- a/src/testing/sub_test.go
+++ b/src/testing/sub_test.go
@@ -480,9 +480,10 @@ func TestTRun(t *T) {
buf := &bytes.Buffer{}
root := &T{
common: common{
- signal: make(chan bool),
- name: "Test",
- w: buf,
+ signal: make(chan bool),
+ barrier: make(chan bool),
+ name: "Test",
+ w: buf,
},
context: ctx,
}