Skip to content

Commit ed56ea7

Browse files
committed
path/filepath: deflake TestEvalSymlinksAboveRoot on darwin
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>
1 parent c080d03 commit ed56ea7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/path/filepath/path_test.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,11 +1469,16 @@ func TestEvalSymlinksAboveRoot(t *testing.T) {
14691469
// Try different numbers of "..".
14701470
for _, i := range []int{c, c + 1, c + 2} {
14711471
check := strings.Join([]string{evalTmpDir, strings.Join(dd[:i], string(os.PathSeparator)), evalTmpDir[len(vol)+1:], "b", "file"}, string(os.PathSeparator))
1472-
if resolved, err := filepath.EvalSymlinks(check); err != nil {
1472+
resolved, err := filepath.EvalSymlinks(check)
1473+
switch {
1474+
case runtime.GOOS == "darwin" && errors.Is(err, fs.ErrNotExist):
1475+
// On darwin, the temp dir is sometimes cleaned up mid-test (issue 37910).
1476+
testenv.SkipFlaky(t, 37910)
1477+
case err != nil:
14731478
t.Errorf("EvalSymlinks(%q) failed: %v", check, err)
1474-
} else if !strings.HasSuffix(resolved, wantSuffix) {
1479+
case !strings.HasSuffix(resolved, wantSuffix):
14751480
t.Errorf("EvalSymlinks(%q) = %q does not end with %q", check, resolved, wantSuffix)
1476-
} else {
1481+
default:
14771482
t.Logf("EvalSymlinks(%q) = %q", check, resolved)
14781483
}
14791484
}

0 commit comments

Comments
 (0)