Skip to content

Commit 9b8750f

Browse files
ianlancetaylorgopherbot
authored andcommitted
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 <[email protected]> Reviewed-by: Bryan Mills <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent e8f78cb commit 9b8750f

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/os/os_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,11 @@ func TestLstat(t *testing.T) {
274274
if !equal(sfname, dir.Name()) {
275275
t.Error("name should be ", sfname, "; is", dir.Name())
276276
}
277-
filesize := size(path, t)
278-
if dir.Size() != filesize {
279-
t.Error("size should be", filesize, "; is", dir.Size())
277+
if dir.Mode()&ModeSymlink == 0 {
278+
filesize := size(path, t)
279+
if dir.Size() != filesize {
280+
t.Error("size should be", filesize, "; is", dir.Size())
281+
}
280282
}
281283
}
282284

0 commit comments

Comments
 (0)