]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/syntax: skip GOROOT/misc in TestStdLib if it doesn't exist
authorBryan C. Mills <bcmills@google.com>
Fri, 16 Jun 2023 19:56:37 +0000 (15:56 -0400)
committerGopher Robot <gobot@golang.org>
Fri, 16 Jun 2023 20:47:32 +0000 (20:47 +0000)
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 <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>

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

index 74583ca9036b75fb493550c61c5c6a2b759bc3a8..d5d4290f59bc309a5a8dd68e8bbdc557a3189a55 100644 (file)
@@ -70,6 +70,18 @@ func TestStdLib(t *testing.T) {
                        filepath.Join(goroot, "src"),
                        filepath.Join(goroot, "misc"),
                } {
+                       if filepath.Base(dir) == "misc" {
+                               // cmd/distpack deletes GOROOT/misc, so skip that directory if it isn't present.
+                               // cmd/distpack also requires GOROOT/VERSION to exist, so use that to
+                               // suppress false-positive skips.
+                               if _, err := os.Stat(dir); os.IsNotExist(err) {
+                                       if _, err := os.Stat(filepath.Join(testenv.GOROOT(t), "VERSION")); err == nil {
+                                               fmt.Printf("%s not present; skipping\n", dir)
+                                               continue
+                                       }
+                               }
+                       }
+
                        walkDirs(t, dir, func(filename string) {
                                if skipRx != nil && skipRx.MatchString(filename) {
                                        // Always report skipped files since regexp