diff options
author | Ian Lance Taylor <iant@golang.org> | 2022-12-09 11:22:32 -0800 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2022-12-10 00:35:24 +0000 |
commit | 9b8750f53ed89fb326e4d811524e647683136bac (patch) | |
tree | a4d6e03fa124a6d9342d90ad2f28aedc9855c668 | |
parent | e8f78cb60caab4f7ca8d0f4c424f14cc74ab49a4 (diff) | |
download | go-9b8750f53ed89fb326e4d811524e647683136bac.tar.gz go-9b8750f53ed89fb326e4d811524e647683136bac.zip |
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>
-rw-r--r-- | src/os/os_test.go | 8 |
1 files changed, 5 insertions, 3 deletions
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()) + } } } |