diff --git a/misc/cgo/testcarchive/carchive_test.go b/misc/cgo/testcarchive/carchive_test.go index 1fa3f21491..381239ab79 100644 --- a/misc/cgo/testcarchive/carchive_test.go +++ b/misc/cgo/testcarchive/carchive_test.go @@ -8,6 +8,7 @@ import ( "bufio" "bytes" "debug/elf" + "flag" "fmt" "io/ioutil" "log" @@ -36,6 +37,11 @@ var GOOS, GOARCH, GOPATH string var libgodir string func TestMain(m *testing.M) { + flag.Parse() + if testing.Short() && os.Getenv("GO_BUILDER_NAME") == "" { + fmt.Printf("SKIP - short mode and $GO_BUILDER_NAME not set\n") + os.Exit(0) + } log.SetFlags(log.Lshortfile) os.Exit(testMain(m)) } diff --git a/misc/cgo/testcshared/cshared_test.go b/misc/cgo/testcshared/cshared_test.go index 4b3968e417..daef3a9e54 100644 --- a/misc/cgo/testcshared/cshared_test.go +++ b/misc/cgo/testcshared/cshared_test.go @@ -7,6 +7,7 @@ package cshared_test import ( "bytes" "debug/elf" + "flag" "fmt" "io/ioutil" "log" @@ -36,6 +37,11 @@ func TestMain(m *testing.M) { func testMain(m *testing.M) int { log.SetFlags(log.Lshortfile) + flag.Parse() + if testing.Short() && os.Getenv("GO_BUILDER_NAME") == "" { + fmt.Printf("SKIP - short mode and $GO_BUILDER_NAME not set\n") + os.Exit(0) + } GOOS = goEnv("GOOS") GOARCH = goEnv("GOARCH") diff --git a/misc/cgo/testplugin/plugin_test.go b/misc/cgo/testplugin/plugin_test.go index 54e3db36c4..7e2b6eb04c 100644 --- a/misc/cgo/testplugin/plugin_test.go +++ b/misc/cgo/testplugin/plugin_test.go @@ -7,6 +7,7 @@ package plugin_test import ( "bytes" "context" + "flag" "fmt" "io/ioutil" "log" @@ -22,6 +23,11 @@ import ( var gcflags string = os.Getenv("GO_GCFLAGS") func TestMain(m *testing.M) { + flag.Parse() + if testing.Short() && os.Getenv("GO_BUILDER_NAME") == "" { + fmt.Printf("SKIP - short mode and $GO_BUILDER_NAME not set\n") + os.Exit(0) + } log.SetFlags(log.Lshortfile) os.Exit(testMain(m)) } diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go index 8f9aabdbbd..54d9a644ba 100644 --- a/src/cmd/dist/test.go +++ b/src/cmd/dist/test.go @@ -991,7 +991,7 @@ func (t *tester) runHostTest(dir, pkg string) error { if err := cmd.Run(); err != nil { return err } - return t.dirCmd(dir, "./test.test").Run() + return t.dirCmd(dir, "./test.test", "-test.short").Run() } func (t *tester) cgoTest(dt *distTest) error {