-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/go, testing: race detector finding a data race doesn't fail a test #15972
Comments
It's true: we don't know which test case has the race. We just know that the overall test binary failed. In general test cases can run in parallel or have their background goroutines keep running after the test case is ostensibly over. So assigning races to specific test cases is harder than it sounds. Even so, if the race detector exposed the count of problems found so far, we could at least check to see if it increased during a particular test case. @dvyukov, is it easy for Go to fetch the number of reported problems out of the race detector library on demand? Thanks. |
Requested in: golang/go#15972 Will help to fail individual test cases with races. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@285455 91177308-0d34-0410-b5e6-96231b3b80d8
CL https://golang.org/cl/32160 mentions this issue. |
This updates the runtime to HEAD to keep it aligned and fixes some bugs. http://llvm.org/viewvc/llvm-project?view=revision&revision=285454 fixes the crash on darwin related to unaligned data section (#17065). http://llvm.org/viewvc/llvm-project?view=revision&revision=285451 enables core dumps by default (#16527). http://llvm.org/viewvc/llvm-project?view=revision&revision=285455 adds a hook to obtain number of races reported so far (#15972). Can now be obtained with: //go:nosplit func RaceReportCount() int { var n uint64 racecall(&__tsan_report_count, uintptr(unsafe.Pointer(&n)), 0, 0, 0) return int(n) } Fixes #16527. Fixes #17065. Update #15972. Change-Id: I8f869cb6275c9521a47303f3810a9965e9314357 Reviewed-on: https://go-review.googlesource.com/32160 Run-TryBot: Dmitry Vyukov <dvyukov@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
The updated race runtime exposes number of found races. It can be obtained with:
|
Requested in: golang/go#15972 Will help to fail individual test cases with races. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@285455 91177308-0d34-0410-b5e6-96231b3b80d8
CL https://golang.org/cl/32615 mentions this issue. |
Environment details:
What did you do?
Run a unit test with a data race using the following invocation:
What did you expect to see?
When the race detector is enabled and a data race is found, the unit test will fail.
What did you see instead?
The test passes, but the package fails:
The text was updated successfully, but these errors were encountered: