Skip to content

Commit 4d48798

Browse files
committed
all: fix x/tools tests that fail with a go1.23.1 go.work file
Delete or selectively skip tests that made either of the following assumptions: - The default GODEBUG is that of Go 1.22 (not true given a go.work file). - GOROOT is a development version of Go (not true if GOROOT is prepared by cmd/distpack). Fixes golang/go#70081 Fixes golang/go#70082 Change-Id: I47dfb225427f75e3be833eed3ba677ff454935f1 Reviewed-on: https://go-review.googlesource.com/c/tools/+/622896 Reviewed-by: Alan Donovan <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 5e6a32d commit 4d48798

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

internal/testenv/testenv.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,3 +490,17 @@ func NeedsGoExperiment(t testing.TB, flag string) {
490490
t.Skipf("skipping test: flag %q is not set in GOEXPERIMENT=%q", flag, goexp)
491491
}
492492
}
493+
494+
// NeedsGOROOTDir skips the test if GOROOT/dir does not exist, and GOROOT is a
495+
// released version of Go (=has a VERSION file). Some GOROOT directories are
496+
// removed by cmd/distpack.
497+
//
498+
// See also golang/go#70081.
499+
func NeedsGOROOTDir(t *testing.T, dir string) {
500+
gorootTest := filepath.Join(GOROOT(t), dir)
501+
if _, err := os.Stat(gorootTest); os.IsNotExist(err) {
502+
if _, err := os.Stat(filepath.Join(GOROOT(t), "VERSION")); err == nil {
503+
t.Skipf("skipping: GOROOT/%s not present", dir)
504+
}
505+
}
506+
}

0 commit comments

Comments
 (0)