aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/race
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2020-11-14 14:29:31 -0500
committerCherry Zhang <cherryyz@google.com>2020-11-16 17:27:26 +0000
commitd834ecec8637e3d54b67debf95ceb649cc0b4e1d (patch)
tree28e73d68f693fd043f4c32ba7a034f6eed448b84 /src/runtime/race
parent0932dc21180642ce1ff095b9b3e68b06c6f440b3 (diff)
downloadgo-d834ecec8637e3d54b67debf95ceb649cc0b4e1d.tar.gz
go-d834ecec8637e3d54b67debf95ceb649cc0b4e1d.zip
runtime/race: reject runtime fatal error in tests
We expect those tests to fail with non-zero exit code, due to intentional races, but we don't expect the runtime to crash. Reject that. Change-Id: Ic37987dabecde5f0703c031c49ce7f884a7b06a5 Reviewed-on: https://go-review.googlesource.com/c/go/+/270398 Trust: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/race')
-rw-r--r--src/runtime/race/race_test.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/runtime/race/race_test.go b/src/runtime/race/race_test.go
index a0b8531b42..d433af6bd0 100644
--- a/src/runtime/race/race_test.go
+++ b/src/runtime/race/race_test.go
@@ -177,6 +177,10 @@ func runTests(t *testing.T) ([]byte, error) {
)
// There are races: we expect tests to fail and the exit code to be non-zero.
out, _ := cmd.CombinedOutput()
+ if bytes.Contains(out, []byte("fatal error:")) {
+ // But don't expect runtime to crash.
+ return out, fmt.Errorf("runtime fatal error")
+ }
return out, nil
}