diff options
| author | Cherry Mui <cherryyz@google.com> | 2026-03-27 12:58:34 -0400 |
|---|---|---|
| committer | Cherry Mui <cherryyz@google.com> | 2026-03-27 11:22:02 -0700 |
| commit | eeefb11776b91e4c758306d00094dccddffc8ce8 (patch) | |
| tree | d7cc80a1ad88656a7451c9cd17a3c6b403e40b74 /src | |
| parent | 00146b7babad513b9b79b4b00a12acc18594791b (diff) | |
| download | go-eeefb11776b91e4c758306d00094dccddffc8ce8.tar.xz | |
cmd/go/internal/verylongtest: run tests in a separate GOCACHE
Based on the timing, the move to verylongtest seems to be related
to the start of #78180 flakiness. Run the tests in a separate
GOCACHE to isolate even more. Some tests indeed do something
unusual, like setting a umask, which could cause files in the
build cache to have an unusual permission. I'm not sure whether
and how the flaky failure could be related to this. Just give it
a shot.
Using a fresh GOCACHE might make it rebuild more packages. But it
is verylongtest anyway. Make it skip in short mode.
For #78180.
Change-Id: I5c9f83794d15310ffca8ba3dfa739016a5b8e899
Reviewed-on: https://go-review.googlesource.com/c/go/+/760382
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/go/internal/verylongtest/go_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/cmd/go/internal/verylongtest/go_test.go b/src/cmd/go/internal/verylongtest/go_test.go index eae8b85a45..8a2acf3690 100644 --- a/src/cmd/go/internal/verylongtest/go_test.go +++ b/src/cmd/go/internal/verylongtest/go_test.go @@ -6,6 +6,8 @@ package verylongtest import ( "bytes" + "flag" + "fmt" "internal/testenv" "os" "os/exec" @@ -13,6 +15,25 @@ import ( "testing" ) +func TestMain(m *testing.M) { + flag.Parse() + if testing.Short() { + return + } + + tmpdir, err := os.MkdirTemp("", "verylongtest") + if err != nil { + fmt.Fprintf(os.Stderr, "failed to create temp gocache: %v\n", err) + os.Exit(1) + } + os.Setenv("GOCACHE", tmpdir) + + code := m.Run() + + os.RemoveAll(tmpdir) + os.Exit(code) +} + // Regression test for golang.org/issue/34499: version command should not crash // when executed in a deleted directory on Linux. func TestExecInDeletedDir(t *testing.T) { |
