mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
os: give race detector chance to override Exit(0)
Racy tests do not fail currently, they do os.Exit(0). So if you run go test without -v, you won't even notice. This was probably introduced with testing.TestMain. Racy programs do not have the right to finish successfully. Change-Id: Id133d7424f03d90d438bc3478528683dd02b8846 Reviewed-on: https://go-review.googlesource.com/4371 Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
7b2b45e544
commit
c61d86af72
3 changed files with 49 additions and 9 deletions
|
|
@ -105,6 +105,14 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
// os_beforeExit is called from os.Exit(0).
|
||||
//go:linkname os_beforeExit os.runtime_beforeExit
|
||||
func os_beforeExit() {
|
||||
if raceenabled {
|
||||
racefini()
|
||||
}
|
||||
}
|
||||
|
||||
// start forcegc helper goroutine
|
||||
func init() {
|
||||
go forcegchelper()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue