diff options
author | Bryan C. Mills <bcmills@google.com> | 2023-06-16 15:45:13 -0400 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2023-06-16 20:45:36 +0000 |
commit | 199fbd4b5911d90a99b13db44e5f2a9ca85f0d9e (patch) | |
tree | 3720694dbcea90c4eb391b91512c209b443c20f6 | |
parent | a48f9c26d5735e7612d919ffe7809e701ffe0a76 (diff) | |
download | go-199fbd4b5911d90a99b13db44e5f2a9ca85f0d9e.tar.gz go-199fbd4b5911d90a99b13db44e5f2a9ca85f0d9e.zip |
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 <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
-rw-r--r-- | src/cmd/internal/testdir/testdir_test.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cmd/internal/testdir/testdir_test.go b/src/cmd/internal/testdir/testdir_test.go index 7ab1143584..bd7785900c 100644 --- a/src/cmd/internal/testdir/testdir_test.go +++ b/src/cmd/internal/testdir/testdir_test.go @@ -117,6 +117,15 @@ func Test(t *testing.T) { runoutputGate: make(chan bool, *runoutputLimit), } + // cmd/distpack deletes GOROOT/test, so skip the test 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(common.gorootTestDir); os.IsNotExist(err) { + if _, err := os.Stat(filepath.Join(testenv.GOROOT(t), "VERSION")); err == nil { + t.Skipf("skipping: GOROOT/test not present") + } + } + for _, dir := range dirs { for _, goFile := range goFiles(t, dir) { test := test{testCommon: common, dir: dir, goFile: goFile} |