]> Cypherpunks repositories - gostls13.git/commitdiff
misc/cgo: disable testcarchive, testplugin during -short test (including all.bash)
authorRuss Cox <rsc@golang.org>
Wed, 15 May 2019 18:31:48 +0000 (14:31 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 16 May 2019 03:25:04 +0000 (03:25 +0000)
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 <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
misc/cgo/testcarchive/carchive_test.go
misc/cgo/testcshared/cshared_test.go
misc/cgo/testplugin/plugin_test.go
src/cmd/dist/test.go

index 1fa3f21491441e66d82ebbeb7815a717023f09ab..381239ab7980172dcc6838f70847024f716ca54a 100644 (file)
@@ -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))
 }
index 4b3968e417130f51805b95ff2a9428bd697b21a8..daef3a9e54644d322212fd7bdd0d9f27147f189a 100644 (file)
@@ -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")
index 54e3db36c4601a7eadcb6a827c24a66bc58310eb..7e2b6eb04c0d8b65d3ee740ca53936b44600fa80 100644 (file)
@@ -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))
 }
index 8f9aabdbbd189d98e25e06d8f7ffe30be38fdce5..54d9a644bafaca7859808efc7979047d0dedb72a 100644 (file)
@@ -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 {