]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/cmd/go/go_test.go
[dev.boringcrypto] all: merge master into dev.boringcrypto
[gostls13.git] / src / cmd / go / go_test.go
index 8a091c5dbef488168b66a643e4b705c5628a6e0e..4a81c826a5f542ff4e9378498239ffd97e018896 100644 (file)
@@ -13,6 +13,7 @@ import (
        "flag"
        "fmt"
        "go/format"
+       "internal/godebug"
        "internal/race"
        "internal/testenv"
        "io"
@@ -31,7 +32,6 @@ import (
        "cmd/go/internal/cache"
        "cmd/go/internal/cfg"
        "cmd/go/internal/robustio"
-       "cmd/go/internal/work"
        "cmd/internal/sys"
 )
 
@@ -44,9 +44,12 @@ func init() {
 }
 
 var (
-       canRace = false // whether we can run the race detector
-       canCgo  = false // whether we can use cgo
-       canMSan = false // whether we can run the memory sanitizer
+       canRace          = false // whether we can run the race detector
+       canCgo           = false // whether we can use cgo
+       canMSan          = false // whether we can run the memory sanitizer
+       canASan          = false // whether we can run the address sanitizer
+       canFuzz          = false // whether we can search for new fuzz failures
+       fuzzInstrumented = false // whether fuzzing uses instrumentation
 )
 
 var exeSuffix string = func() string {
@@ -198,6 +201,7 @@ func TestMain(m *testing.M) {
                testGOCACHE = strings.TrimSpace(string(out))
 
                canMSan = canCgo && sys.MSanSupported(runtime.GOOS, runtime.GOARCH)
+               canASan = canCgo && sys.ASanSupported(runtime.GOOS, runtime.GOARCH)
                canRace = canCgo && sys.RaceDetectorSupported(runtime.GOOS, runtime.GOARCH)
                // The race detector doesn't work on Alpine Linux:
                // golang.org/issue/14481
@@ -205,6 +209,8 @@ func TestMain(m *testing.M) {
                if isAlpineLinux() || runtime.Compiler == "gccgo" {
                        canRace = false
                }
+               canFuzz = sys.FuzzSupported(runtime.GOOS, runtime.GOARCH)
+               fuzzInstrumented = sys.FuzzInstrumented(runtime.GOOS, runtime.GOARCH)
        }
        // Don't let these environment variables confuse the test.
        os.Setenv("GOENV", "off")
@@ -1378,10 +1384,10 @@ func TestLdFlagsLongArgumentsIssue42295(t *testing.T) {
                }`)
        testStr := "test test test test test \n\\ "
        var buf bytes.Buffer
-       for buf.Len() < work.ArgLengthForResponseFile+1 {
+       for buf.Len() < sys.ExecArgLengthLimit+1 {
                buf.WriteString(testStr)
        }
-       tg.run("run", "-ldflags", fmt.Sprintf(`-X "main.extern=%s"`, buf.String()), tg.path("main.go"))
+       tg.run("run", "-buildinfo=false", "-ldflags", fmt.Sprintf(`-X "main.extern=%s"`, buf.String()), tg.path("main.go"))
        if tg.stderr.String() != buf.String() {
                t.Errorf("strings differ")
        }
@@ -2284,7 +2290,7 @@ func TestUpxCompression(t *testing.T) {
 
 func TestCacheListStale(t *testing.T) {
        tooSlow(t)
-       if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") {
+       if godebug.Get("gocacheverify") == "1" {
                t.Skip("GODEBUG gocacheverify")
        }
        tg := testgo(t)
@@ -2307,7 +2313,7 @@ func TestCacheListStale(t *testing.T) {
 func TestCacheCoverage(t *testing.T) {
        tooSlow(t)
 
-       if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") {
+       if godebug.Get("gocacheverify") == "1" {
                t.Skip("GODEBUG gocacheverify")
        }
 
@@ -2339,7 +2345,7 @@ func TestIssue22588(t *testing.T) {
 
 func TestIssue22531(t *testing.T) {
        tooSlow(t)
-       if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") {
+       if godebug.Get("gocacheverify") == "1" {
                t.Skip("GODEBUG gocacheverify")
        }
        tg := testgo(t)
@@ -2368,7 +2374,7 @@ func TestIssue22531(t *testing.T) {
 
 func TestIssue22596(t *testing.T) {
        tooSlow(t)
-       if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") {
+       if godebug.Get("gocacheverify") == "1" {
                t.Skip("GODEBUG gocacheverify")
        }
        tg := testgo(t)
@@ -2398,7 +2404,7 @@ func TestIssue22596(t *testing.T) {
 func TestTestCache(t *testing.T) {
        tooSlow(t)
 
-       if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") {
+       if godebug.Get("gocacheverify") == "1" {
                t.Skip("GODEBUG gocacheverify")
        }
        tg := testgo(t)