mirror of
https://github.com/golang/go
synced 2024-09-29 14:14:29 -06:00
runtime: change exit hooks test to use RaceDetectorSupported
Use internal/syssup.RaceDetectorSupported in the exit hooks tests as a better way to tell if the race detector is available. Change-Id: I8f43f93319f68b9910f2eea88fc375f7ef3bb2e4 Reviewed-on: https://go-review.googlesource.com/c/go/+/438476 Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
cddf792428
commit
841873f27c
@ -5,6 +5,7 @@
|
||||
package runtime_test
|
||||
|
||||
import (
|
||||
"internal/platform"
|
||||
"internal/testenv"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
@ -14,12 +15,13 @@ import (
|
||||
|
||||
func TestExitHooks(t *testing.T) {
|
||||
bmodes := []string{""}
|
||||
// Race detector is not supported everywhere -- limit to just
|
||||
// linux/amd64 to keep things simple. Note the HasCGO() test
|
||||
// below; this is to prevent the test running if CGO_ENABLED=0
|
||||
// is in effect.
|
||||
if !testing.Short() && runtime.GOARCH == "amd64" &&
|
||||
runtime.GOOS == "linux" && testenv.HasCGO() {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping due to -short")
|
||||
}
|
||||
// Note the HasCGO() test below; this is to prevent the test
|
||||
// running if CGO_ENABLED=0 is in effect.
|
||||
haverace := platform.RaceDetectorSupported(runtime.GOOS, runtime.GOARCH)
|
||||
if haverace && testenv.HasCGO() {
|
||||
bmodes = append(bmodes, "-race")
|
||||
}
|
||||
for _, bmode := range bmodes {
|
||||
|
Loading…
Reference in New Issue
Block a user