Skip to content

Commit

Permalink
[release-branch.go1.19] os: skip size test in TestLstat if the file i…
Browse files Browse the repository at this point in the history
…s 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 #57214

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 9b8750f)
Reviewed-on: https://go-review.googlesource.com/c/go/+/456560
Reviewed-by: Austin Clements <austin@google.com>
  • Loading branch information
ianlancetaylor authored and gopherbot committed Dec 14, 2022
1 parent 926ffba commit 45ba8ba
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/os/os_test.go
Expand Up @@ -275,9 +275,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())
}
}
}

Expand Down

0 comments on commit 45ba8ba

Please sign in to comment.