Repository navigation
testing: are T.Run and B.Run safe for concurrent use? #18603
Description
Activity
- addedDocumentationIssues describing a change to documentation.Issues describing a change to documentation.
on Jan 11, 2017 If
T.Runwas safe concurrently in Go1.7, even if it was ambiguous whether it should be, it's worth considering whether it should continue to be concurrent safe in Go1.8.\cc @mpvl
(moving to Go1.8Maybe; I don't think this is a release blocker at this point)
- addedNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.Feedback is required from experts, contributors, and/or the community before a change can be made.
on Jan 11, 2017 Not sure whether @mpvl is around. Sent https://go-review.googlesource.com/35354.
/cc @bradfitzCL https://golang.org/cl/35354 mentions this issue.
- addedNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.and removedDocumentationIssues describing a change to documentation.Issues describing a change to documentation.NeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.Feedback is required from experts, contributors, and/or the community before a change can be made.
on Jan 18, 2017 CL https://golang.org/cl/35354 added this comment to B.Run():
// Run may be called simultaneously from multiple goroutines, but all such // calls must happen before the outer benchmark function for b returns.Which I don't think is true at all: calling B.Run() multiple times from multiple goroutines results in benchmarkLock.Unlock() being called multiple times before benchmarkLock.Lock(), which causes a crash.
(example code: https://play.golang.org/p/0u15AvArTK)
- addedDocumentationIssues describing a change to documentation.Issues describing a change to documentation.
on Aug 2, 2017 Is this a documentation issue or a implementation issue? cl/35354 does have a test for multiple goroutines using when using
testing.T.Run, but lacks a test fortesting.B.Run, which clearly seems broken.Are you proposing we properly making
testing.B.Runwork also? or just remove the comment.I don't mind which way it gets resolved, but it's significantly less effort to just remove the comment.
Change https://golang.org/cl/80841 mentions this issue:
testing: remove claim that b.Run is safe for concurrent use- locked and limited conversation to collaborators
on Dec 1, 2018
I do not see any documentation specifying if T.Run is safe for concurrent use. I see the following doc for testing.T, which does not mention T.Run:
There is a similar doc for testing.B.
I ask because I believe T.Run was safe for concurrent use in go 1.7. Then, this line was added in go 1.8, which made T.Run no longer safe for concurrent use. I don't particularly care whether T.Run is safe for concurrent use, but I think the semantics should be clarified.
Optimistically labeling this go1.8.
/cc @dsnet