1
0
mirror of https://github.com/golang/go synced 2024-09-23 09:23:20 -06:00

testing: skip TestChdir/relative when on Windows when GOROOT and TMPDIR are on different drives

Fixes #69159

Change-Id: I0bbcf7075bdcf7a277a5053bcb543563a3074784
GitHub-Last-Rev: 86052a9ce3
GitHub-Pull-Request: golang/go#69160
Reviewed-on: https://go-review.googlesource.com/c/go/+/609304
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
qiulaidongfeng 2024-09-01 00:55:35 +00:00 committed by Damien Neil
parent e23ebec90d
commit 7303a283c4

View File

@ -300,7 +300,9 @@ func TestChdir(t *testing.T) {
}
rel, err := filepath.Rel(oldDir, tmp)
if err != nil {
t.Fatal(err)
// If GOROOT is on C: volume and tmp is on the D: volume, there
// is no relative path between them, so skip that test case.
rel = "skip"
}
for _, tc := range []struct {
@ -331,6 +333,9 @@ func TestChdir(t *testing.T) {
},
} {
t.Run(tc.name, func(t *testing.T) {
if tc.dir == "skip" {
t.Skipf("skipping test because there is no relative path between %s and %s", oldDir, tmp)
}
if !filepath.IsAbs(tc.pwd) {
t.Fatalf("Bad tc.pwd: %q (must be absolute)", tc.pwd)
}