From eeefb11776b91e4c758306d00094dccddffc8ce8 Mon Sep 17 00:00:00 2001 From: Cherry Mui Date: Fri, 27 Mar 2026 12:58:34 -0400 Subject: 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 Reviewed-by: Michael Matloob Reviewed-by: Michael Matloob --- src/cmd/go/internal/verylongtest/go_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/cmd') 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) { -- cgit v1.3