Skip to content

Commit a6a0ed3

Browse files
committed
misc/cgo: disable testcarchive, testplugin during -short test (including all.bash)
These tests take 20 seconds each to rebuild the entire world in their respective modes. That's too much for short mode, including all.bash on developer machines. Keep doing it on builders and if someone runs 'go test' by hand in that directory. For #26473. Change-Id: I3dc6955bc3aa7a20fd170efcde72a7d19b37bdbf Reviewed-on: https://go-review.googlesource.com/c/go/+/177417 Run-TryBot: Russ Cox <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 018d9b4 commit a6a0ed3

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

misc/cgo/testcarchive/carchive_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"bufio"
99
"bytes"
1010
"debug/elf"
11+
"flag"
1112
"fmt"
1213
"io/ioutil"
1314
"log"
@@ -36,6 +37,11 @@ var GOOS, GOARCH, GOPATH string
3637
var libgodir string
3738

3839
func TestMain(m *testing.M) {
40+
flag.Parse()
41+
if testing.Short() && os.Getenv("GO_BUILDER_NAME") == "" {
42+
fmt.Printf("SKIP - short mode and $GO_BUILDER_NAME not set\n")
43+
os.Exit(0)
44+
}
3945
log.SetFlags(log.Lshortfile)
4046
os.Exit(testMain(m))
4147
}

misc/cgo/testcshared/cshared_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package cshared_test
77
import (
88
"bytes"
99
"debug/elf"
10+
"flag"
1011
"fmt"
1112
"io/ioutil"
1213
"log"
@@ -36,6 +37,11 @@ func TestMain(m *testing.M) {
3637

3738
func testMain(m *testing.M) int {
3839
log.SetFlags(log.Lshortfile)
40+
flag.Parse()
41+
if testing.Short() && os.Getenv("GO_BUILDER_NAME") == "" {
42+
fmt.Printf("SKIP - short mode and $GO_BUILDER_NAME not set\n")
43+
os.Exit(0)
44+
}
3945

4046
GOOS = goEnv("GOOS")
4147
GOARCH = goEnv("GOARCH")

misc/cgo/testplugin/plugin_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package plugin_test
77
import (
88
"bytes"
99
"context"
10+
"flag"
1011
"fmt"
1112
"io/ioutil"
1213
"log"
@@ -22,6 +23,11 @@ import (
2223
var gcflags string = os.Getenv("GO_GCFLAGS")
2324

2425
func TestMain(m *testing.M) {
26+
flag.Parse()
27+
if testing.Short() && os.Getenv("GO_BUILDER_NAME") == "" {
28+
fmt.Printf("SKIP - short mode and $GO_BUILDER_NAME not set\n")
29+
os.Exit(0)
30+
}
2531
log.SetFlags(log.Lshortfile)
2632
os.Exit(testMain(m))
2733
}

src/cmd/dist/test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ func (t *tester) runHostTest(dir, pkg string) error {
991991
if err := cmd.Run(); err != nil {
992992
return err
993993
}
994-
return t.dirCmd(dir, "./test.test").Run()
994+
return t.dirCmd(dir, "./test.test", "-test.short").Run()
995995
}
996996

997997
func (t *tester) cgoTest(dt *distTest) error {

0 commit comments

Comments
 (0)