From: Josh Bleecher Snyder Date: Wed, 30 Jun 2021 16:44:30 +0000 (-0700) Subject: path/filepath: deflake TestEvalSymlinksAboveRoot on darwin X-Git-Tag: go1.17rc1~25 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=ed56ea73e8aa60269bbb3d33af9e7614e6b3babf;p=gostls13.git 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 Run-TryBot: Josh Bleecher Snyder TryBot-Result: Go Bot Reviewed-by: Bryan C. Mills --- 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) } }