]> Cypherpunks repositories - gostls13.git/commitdiff
path/filepath: deflake TestEvalSymlinksAboveRoot on darwin
authorJosh Bleecher Snyder <josharian@gmail.com>
Wed, 30 Jun 2021 16:44:30 +0000 (09:44 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Wed, 30 Jun 2021 20:03:34 +0000 (20:03 +0000)
On darwin, under load, it appears that the system occasionally
deletes the temp dir mid-test. Don't fail the test when that happens.

It would be nice to fix this in a deeper way.
See golang.org/cl/332009 for some discussion.

In the meantime, this will at least stop the flakiness.

Updates #37910

Change-Id: I6669e466fed9abda4a87ca88345c04cd7986b41e
Reviewed-on: https://go-review.googlesource.com/c/go/+/332009
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/path/filepath/path_test.go

index cd107b6c85a16e446aa3a941e10f7b5c79bf3961..bc5509b49cf1ab7e4820405a10a869d9b56edd61 100644 (file)
@@ -1469,11 +1469,16 @@ func TestEvalSymlinksAboveRoot(t *testing.T) {
        // Try different numbers of "..".
        for _, i := range []int{c, c + 1, c + 2} {
                check := strings.Join([]string{evalTmpDir, strings.Join(dd[:i], string(os.PathSeparator)), evalTmpDir[len(vol)+1:], "b", "file"}, string(os.PathSeparator))
-               if resolved, err := filepath.EvalSymlinks(check); err != nil {
+               resolved, err := filepath.EvalSymlinks(check)
+               switch {
+               case runtime.GOOS == "darwin" && errors.Is(err, fs.ErrNotExist):
+                       // On darwin, the temp dir is sometimes cleaned up mid-test (issue 37910).
+                       testenv.SkipFlaky(t, 37910)
+               case err != nil:
                        t.Errorf("EvalSymlinks(%q) failed: %v", check, err)
-               } else if !strings.HasSuffix(resolved, wantSuffix) {
+               case !strings.HasSuffix(resolved, wantSuffix):
                        t.Errorf("EvalSymlinks(%q) = %q does not end with %q", check, resolved, wantSuffix)
-               } else {
+               default:
                        t.Logf("EvalSymlinks(%q) = %q", check, resolved)
                }
        }