From: Anmol Sethi Date: Sun, 18 Mar 2018 06:36:40 +0000 (-0400) Subject: testing: fix racey access to t.failed X-Git-Tag: go1.11beta1~566 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=eff1e68528fc9052a7ff1ac7afe222696f85db8c;p=gostls13.git testing: fix racey access to t.failed 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 TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- diff --git a/src/testing/testing.go b/src/testing/testing.go index 429e03676c..573ef05fdc 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -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) }