aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/dist
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2019-12-03 10:38:43 -0500
committerCherry Zhang <cherryyz@google.com>2019-12-03 10:38:43 -0500
commitf7672d39ca9eeb05d0605348290335698da98ae8 (patch)
tree7f5bfe50f6f913ad60c983ad73936dfc8d808567 /src/cmd/dist
parent27c0aeee3fc7ed35f9b2eac4725b9147902537da (diff)
parent2ac1ca9160f52907ce1cd04738c80b1c055b5ba6 (diff)
downloadgo-f7672d39ca9eeb05d0605348290335698da98ae8.tar.xz
[dev.link] all: merge branch 'master' into dev.link
Bring in Than's fix of #35779. The only merge conflict is cmd/link/internal/loadelf/ldelf.go, with a modification-deletion conflict. Change-Id: Id2fcfd2094a31120966a6ea9c462b4ec76646b10
Diffstat (limited to 'src/cmd/dist')
-rw-r--r--src/cmd/dist/test.go23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go
index dc22aad3ed..56bdfcac19 100644
--- a/src/cmd/dist/test.go
+++ b/src/cmd/dist/test.go
@@ -692,7 +692,7 @@ func (t *tester) registerTests() {
t.registerTest("testplugin", "../misc/cgo/testplugin", t.goTest(), t.timeout(600), ".")
}
if gohostos == "linux" && goarch == "amd64" {
- t.registerTest("testasan", "../misc/cgo/testasan", "go", "run", "main.go")
+ t.registerTest("testasan", "../misc/cgo/testasan", "go", "run", ".")
}
if mSanSupported(goos, goarch) {
t.registerHostTest("testsanitizers/msan", "../misc/cgo/testsanitizers", "misc/cgo/testsanitizers", ".")
@@ -701,7 +701,7 @@ func (t *tester) registerTests() {
t.registerHostTest("cgo_errors", "../misc/cgo/errors", "misc/cgo/errors", ".")
}
if gohostos == "linux" && t.extLink() {
- t.registerTest("testsigfwd", "../misc/cgo/testsigfwd", "go", "run", "main.go")
+ t.registerTest("testsigfwd", "../misc/cgo/testsigfwd", "go", "run", ".")
}
}
@@ -1327,7 +1327,6 @@ func (t *tester) runFlag(rx string) string {
}
func (t *tester) raceTest(dt *distTest) error {
- t.addCmd(dt, "src", t.goTest(), "-race", "-i", "runtime/race", "flag", "os", "os/exec")
t.addCmd(dt, "src", t.goTest(), "-race", t.runFlag("Output"), "runtime/race")
t.addCmd(dt, "src", t.goTest(), "-race", t.runFlag("TestParse|TestEcho|TestStdinCloseRace|TestClosedPipeRace|TestTypeRace|TestFdRace|TestFdReadRace|TestFileCloseRace"), "flag", "net", "os", "os/exec", "encoding/gob")
// We don't want the following line, because it
@@ -1449,7 +1448,25 @@ func (t *tester) makeGOROOTUnwritable() (undo func()) {
}
}
+ gocache := os.Getenv("GOCACHE")
+ if gocache == "" {
+ panic("GOCACHE not set")
+ }
+ gocacheSubdir, _ := filepath.Rel(dir, gocache)
+
filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
+ if suffix := strings.TrimPrefix(path, dir+string(filepath.Separator)); suffix != "" {
+ if suffix == gocacheSubdir {
+ // Leave GOCACHE writable: we may need to write test binaries into it.
+ return filepath.SkipDir
+ }
+ if suffix == ".git" {
+ // Leave Git metadata in whatever state it was in. It may contain a lot
+ // of files, and it is highly unlikely that a test will try to modify
+ // anything within that directory.
+ return filepath.SkipDir
+ }
+ }
if err == nil {
mode := info.Mode()
if mode&0222 != 0 && (mode.IsDir() || mode.IsRegular()) {