Skip to content

Commit

Permalink
testing: fix racey access to t.failed
Browse files Browse the repository at this point in the history
We need to grab the mutex before we can access it.

Fixes #24438

Change-Id: Idd6130036691acec5bc5f8b40d6884f8db1d9d3c
Reviewed-on: https://go-review.googlesource.com/101283
Run-TryBot: Ian Lance Taylor <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
  • Loading branch information
nhooyr authored and ianlancetaylor committed May 2, 2018
1 parent 0dcdbc7 commit eff1e68
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/testing/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ func tRunner(t *T, fn func(t *T)) {
// a call to runtime.Goexit, record the duration and send
// a signal saying that the test is done.
defer func() {
if t.failed {
if t.Failed() {
atomic.AddUint32(&numFailed, 1)
}

Expand Down

0 comments on commit eff1e68

Please sign in to comment.