1
0
mirror of https://github.com/golang/go synced 2024-11-26 04:17:59 -07:00

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>
This commit is contained in:
Cherry Zhang 2020-11-14 14:29:31 -05:00
parent 0932dc2118
commit d834ecec86

View File

@ -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
}