From eff1e68528fc9052a7ff1ac7afe222696f85db8c Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Sun, 18 Mar 2018 02:36:40 -0400 Subject: [PATCH] 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 --- src/testing/testing.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/testing/testing.go b/src/testing/testing.go index 429e03676c4..573ef05fdc4 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) }