Skip to content

Commit 199fbd4

Browse files
Bryan C. Millsgopherbot
Bryan C. Mills
authored andcommitted
cmd/internal/testdir: skip Test if GOROOT/test does not exist
cmd/distpack removes GOROOT/test from its distribution. For #24904. Change-Id: I6d1a8c608a1a1fe3fddfe0cd5279202ea9c2b3ce Reviewed-on: https://go-review.googlesource.com/c/go/+/504058 Run-TryBot: Bryan Mills <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Auto-Submit: Bryan Mills <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent a48f9c2 commit 199fbd4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/cmd/internal/testdir/testdir_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,15 @@ func Test(t *testing.T) {
117117
runoutputGate: make(chan bool, *runoutputLimit),
118118
}
119119

120+
// cmd/distpack deletes GOROOT/test, so skip the test if it isn't present.
121+
// cmd/distpack also requires GOROOT/VERSION to exist, so use that to
122+
// suppress false-positive skips.
123+
if _, err := os.Stat(common.gorootTestDir); os.IsNotExist(err) {
124+
if _, err := os.Stat(filepath.Join(testenv.GOROOT(t), "VERSION")); err == nil {
125+
t.Skipf("skipping: GOROOT/test not present")
126+
}
127+
}
128+
120129
for _, dir := range dirs {
121130
for _, goFile := range goFiles(t, dir) {
122131
test := test{testCommon: common, dir: dir, goFile: goFile}

0 commit comments

Comments
 (0)