aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2021-06-30 09:44:30 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2021-06-30 20:03:34 +0000
commited56ea73e8aa60269bbb3d33af9e7614e6b3babf (patch)
tree4c4bb34521180dde69948808f829286103b3b28b
parentc080d0323bce56e25622a51dffecf756758c95a1 (diff)
downloadgo-ed56ea73e8aa60269bbb3d33af9e7614e6b3babf.tar.gz
go-ed56ea73e8aa60269bbb3d33af9e7614e6b3babf.zip
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>
-rw-r--r--src/path/filepath/path_test.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/path/filepath/path_test.go b/src/path/filepath/path_test.go
index cd107b6c85..bc5509b49c 100644
--- a/src/path/filepath/path_test.go
+++ b/src/path/filepath/path_test.go
@@ -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)
}
}