aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing.go
diff options
context:
space:
mode:
authorChangkun Ou <hi@changkun.de>2021-09-27 12:06:43 +0200
committerGopher Robot <gobot@golang.org>2022-11-14 17:37:45 +0000
commita650e399dfc2435eb18efc430a70cba9d87cec73 (patch)
tree1f55e0e95ab9251e69897f891fec6f3ed9162835 /src/testing/testing.go
parentea4631cc0cf301c824bd665a7980c13289ab5c9d (diff)
downloadgo-a650e399dfc2435eb18efc430a70cba9d87cec73.tar.xz
testing: fix error message when a parallel Cleanup calls runtime.Goexit
Fixes #48502 Change-Id: I6054b043ebd2237e19897fdf1234b311d19facc7 Reviewed-on: https://go-review.googlesource.com/c/go/+/352350 Reviewed-by: Joedian Reid <joedian@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Changkun Ou <mail@changkun.de> Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com>
Diffstat (limited to 'src/testing/testing.go')
-rw-r--r--src/testing/testing.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/testing/testing.go b/src/testing/testing.go
index b2a65e95d3..8d3129fbcd 100644
--- a/src/testing/testing.go
+++ b/src/testing/testing.go
@@ -1462,8 +1462,10 @@ func tRunner(t *T, fn func(t *T)) {
finished = p.finished
p.mu.RUnlock()
if finished {
- t.Errorf("%v: subtest may have called FailNow on a parent test", err)
- err = nil
+ if !t.isParallel {
+ t.Errorf("%v: subtest may have called FailNow on a parent test", err)
+ err = nil
+ }
signal = false
break
}