mirror of
https://github.com/golang/go
synced 2024-11-11 19:41:36 -07:00
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>
This commit is contained in:
parent
c080d0323b
commit
ed56ea73e8
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user