mirror of
https://github.com/golang/go
synced 2024-09-29 22:34:33 -06:00
runtime: add cgo guard for exit hooks test
Add an additional guard to ensure that we don't try to run the "-race" variant of the exit hooks test when CGO is explicitly turned off via CGO_ENABLED=0 (this fixes a failure on the no-cgo builder caused by CL 354790). Change-Id: I9dc7fbd71962e9a098916da69d9119a753f27116 Reviewed-on: https://go-review.googlesource.com/c/go/+/434935 Run-TryBot: Than McIntosh <thanm@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
f6e1677428
commit
550864e5d2
@ -5,6 +5,7 @@
|
||||
package runtime_test
|
||||
|
||||
import (
|
||||
"internal/testenv"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strings"
|
||||
@ -12,16 +13,16 @@ import (
|
||||
)
|
||||
|
||||
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
|
||||
|
@ -10,8 +10,6 @@ import (
|
||||
_ "unsafe"
|
||||
)
|
||||
|
||||
import "C"
|
||||
|
||||
var modeflag = flag.String("mode", "", "mode to run in")
|
||||
|
||||
func main() {
|
||||
|
Loading…
Reference in New Issue
Block a user