]> Cypherpunks repositories - gostls13.git/commitdiff
testing: skip TestChdir/relative when on Windows when GOROOT and TMPDIR are on differ...
authorqiulaidongfeng <2645477756@qq.com>
Sun, 1 Sep 2024 00:55:35 +0000 (00:55 +0000)
committerDamien Neil <dneil@google.com>
Tue, 3 Sep 2024 18:01:12 +0000 (18:01 +0000)
Fixes #69159

Change-Id: I0bbcf7075bdcf7a277a5053bcb543563a3074784
GitHub-Last-Rev: 86052a9ce32a871d6ad62f772f22852b2c6139a6
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>

src/testing/testing_test.go

index 1dd2039399b6cf81c0470ea2245a753145b5931a..f53c2339051de76f18ca1d72fe6526ac6ff8424d 100644 (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)
                        }