package runtime_test
import (
+ "internal/testenv"
"os/exec"
"runtime"
"strings"
)
func TestExitHooks(t *testing.T) {
- bmodes := []string{"", "-race"}
- if !testing.Short() {
+ 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() {
bmodes = append(bmodes, "-race")
}
for _, bmode := range bmodes {
- // Race detector is not supported everywhere -- limit to just
- // amd64 to keep things simple.
- if bmode == "-race" && runtime.GOARCH != "amd64" {
- t.Skipf("Skipping on %s/%s", runtime.GOOS, runtime.GOARCH)
- }
scenarios := []struct {
mode string
expected string