diff options
author | Ian Lance Taylor <iant@golang.org> | 2022-12-09 11:22:32 -0800 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2022-12-14 20:48:43 +0000 |
commit | f92317e69bc0d3a19f472d9cfb3d2c6e5c8463e7 (patch) | |
tree | 7046900c0ca4a286c1b6916861fac71ea23fdbad | |
parent | 63dd776220bb3a443e6b5c0766a389ec33dc4b69 (diff) | |
download | go-f92317e69bc0d3a19f472d9cfb3d2c6e5c8463e7.tar.gz go-f92317e69bc0d3a19f472d9cfb3d2c6e5c8463e7.zip |
[release-branch.go1.18] 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.
For #57210
Fixes #57213
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>
(cherry picked from commit 9b8750f53ed89fb326e4d811524e647683136bac)
Reviewed-on: https://go-review.googlesource.com/c/go/+/456561
Reviewed-by: Austin Clements <austin@google.com>
-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 4124be13cc..3721e15027 100644 --- a/src/os/os_test.go +++ b/src/os/os_test.go @@ -252,9 +252,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()) + } } } |