1
0
mirror of https://github.com/golang/go synced 2024-11-23 20:00:04 -07:00

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 <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Ian Lance Taylor 2022-12-09 11:22:32 -08:00 committed by Gopher Robot
parent e8f78cb60c
commit 9b8750f53e

View File

@ -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())
}
}
}