aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2017-08-08 15:50:43 -0700
committerIan Lance Taylor <iant@golang.org>2017-08-15 22:59:26 +0000
commita1371756c368e4d85cfb84ac8ffc53180aa4d2f2 (patch)
tree43d47f182a06eeee3b89527df0286e047bcd8237 /src/testing/testing.go
parenta14a8a3eb99658b6a0856b664cf900c861a2e306 (diff)
downloadgo-a1371756c368e4d85cfb84ac8ffc53180aa4d2f2.tar.xz
testing: don't fail all tests after racy test failure
The code was adding race.Errors to t.raceErrors before checking Failed, but Failed was using t.raceErrors+race.Errors. We don't want to change Failed, since that would affect tests themselves, so modify the harness to not unnecessarily change t.raceErrors. Updates #19851 Fixes #21338 Change-Id: I7bfdf281f90e045146c92444f1370d55c45221d4 Reviewed-on: https://go-review.googlesource.com/54050 Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com> Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/testing/testing.go')
-rw-r--r--src/testing/testing.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/testing/testing.go b/src/testing/testing.go
index 02b2d730eb..93297b2dca 100644
--- a/src/testing/testing.go
+++ b/src/testing/testing.go
@@ -697,8 +697,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() {
- t.raceErrors += race.Errors()
- if t.raceErrors > 0 {
+ if t.raceErrors+race.Errors() > 0 {
t.Errorf("race detected during execution of test")
}