"flag"
"fmt"
"go/format"
+ "internal/godebug"
"internal/race"
"internal/testenv"
"io"
"cmd/go/internal/cache"
"cmd/go/internal/cfg"
"cmd/go/internal/robustio"
- "cmd/go/internal/work"
"cmd/internal/sys"
)
}
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 {
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
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")
}`)
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")
}
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)
func TestCacheCoverage(t *testing.T) {
tooSlow(t)
- if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") {
+ if godebug.Get("gocacheverify") == "1" {
t.Skip("GODEBUG gocacheverify")
}
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)
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)
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)