From: Ian Lance Taylor Date: Fri, 9 Dec 2022 19:22:32 +0000 (-0800) Subject: os: skip size test in TestLstat if the file is a symlink X-Git-Tag: go1.20rc2~1^2~42 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9b8750f53ed89fb326e4d811524e647683136bac;p=gostls13.git os: skip size test in TestLstat if the file is a symlink Tested by temporarily changing sysdir to use a directory where the expected files were all symlinks. We should consider using a different approach that doesn't rely on sysdir, but for now do a minimal fix. Fixes #57210 Change-Id: Ifb1becef03e014ceb48290ce13527b3e103c0e07 Reviewed-on: https://go-review.googlesource.com/c/go/+/456557 Reviewed-by: Ian Lance Taylor Reviewed-by: Bryan Mills Run-TryBot: Ian Lance Taylor Auto-Submit: Ian Lance Taylor Run-TryBot: Ian Lance Taylor TryBot-Result: Gopher Robot --- diff --git a/src/os/os_test.go b/src/os/os_test.go index f4103907fa..bc27b2db49 100644 --- a/src/os/os_test.go +++ b/src/os/os_test.go @@ -274,9 +274,11 @@ func TestLstat(t *testing.T) { if !equal(sfname, dir.Name()) { t.Error("name should be ", sfname, "; is", dir.Name()) } - filesize := size(path, t) - if dir.Size() != filesize { - t.Error("size should be", filesize, "; is", dir.Size()) + if dir.Mode()&ModeSymlink == 0 { + filesize := size(path, t) + if dir.Size() != filesize { + t.Error("size should be", filesize, "; is", dir.Size()) + } } }