]> Cypherpunks repositories - gostls13.git/commit
testing: add regression tests for reentrant calls to T.Run
authorBryan C. Mills <bcmills@google.com>
Thu, 30 Nov 2023 16:00:56 +0000 (11:00 -0500)
committerGopher Robot <gobot@golang.org>
Fri, 1 Dec 2023 21:27:08 +0000 (21:27 +0000)
commit26b1694d9ad06b4f237526f507494edb948a4866
treea623ab3a5d3054485971121e07cd5f933c657d80
parentecb9d9b95ccba900de9504b3699a219c84b0aa96
testing: add regression tests for reentrant calls to T.Run

These tests represent two patterns of usage, found in Google-internal
tests, that deadlocked after CL 506755.

TestConcurrentRun is a minor variation on TestParallelSub, with the
additional expectation that the concurrent calls to Run (without
explicit calls to Parallel) proceed without blocking. It replaces
TestParallelSub.

TestParentRun is similar, but instead of calling Run concurrently it
calls Run from within the subtest body. It almost certainly represents
an accidental misuse of T.Run, but since that pattern used to run to
completion we don't want to break it accidentally. (Perhaps it should
be diagnosed with a vet check instead?)

While we are testing concurrency, this also cleans up
TestConcurrentCleanup to use a clearer synchronization pattern.

Fixes #64402.

Change-Id: I14fc7e7085a994c284509eac28190c3a8feb04cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/546019
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
src/testing/sub_test.go
src/testing/testing_test.go