Skip to content

Commit 0183c1a

Browse files
Bryan C. Millsgopherbot
Bryan C. Mills
authored andcommitted
cmd/compile/internal/syntax: skip GOROOT/misc in TestStdLib if it doesn't exist
cmd/distpack deletes GOROOT/misc from its distribution. For #24904. Change-Id: I47c60e9a6d39d015683dde7f44bf7c34517b6a8e Reviewed-on: https://go-review.googlesource.com/c/go/+/504059 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Auto-Submit: Bryan Mills <[email protected]> Run-TryBot: Bryan Mills <[email protected]>
1 parent 199fbd4 commit 0183c1a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/cmd/compile/internal/syntax/parser_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,18 @@ func TestStdLib(t *testing.T) {
7070
filepath.Join(goroot, "src"),
7171
filepath.Join(goroot, "misc"),
7272
} {
73+
if filepath.Base(dir) == "misc" {
74+
// cmd/distpack deletes GOROOT/misc, so skip that directory if it isn't present.
75+
// cmd/distpack also requires GOROOT/VERSION to exist, so use that to
76+
// suppress false-positive skips.
77+
if _, err := os.Stat(dir); os.IsNotExist(err) {
78+
if _, err := os.Stat(filepath.Join(testenv.GOROOT(t), "VERSION")); err == nil {
79+
fmt.Printf("%s not present; skipping\n", dir)
80+
continue
81+
}
82+
}
83+
}
84+
7385
walkDirs(t, dir, func(filename string) {
7486
if skipRx != nil && skipRx.MatchString(filename) {
7587
// Always report skipped files since regexp

0 commit comments

Comments
 (0)