unix: compare Stat_t members in TestFstatat

TestFstatat occasionally fails on some builders due to mismatching
Stat_t info returned by the calls to Fstatat (most likely due to Atime
changing). Fix the test by just comparing some well known members.

Change-Id: I862957ad9d3632173a97d93692a6c672779ac508
Reviewed-on: https://go-review.googlesource.com/c/sys/+/212417
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Tobias Klauser
2019-12-23 10:27:52 +01:00
committed by Tobias Klauser
parent abf886d6f5
commit 5a3cf8467b

View File

@@ -680,8 +680,23 @@ func TestFstatat(t *testing.T) {
t.Fatalf("Fstatat: %v", err)
}
if st1 != st2 {
t.Errorf("Fstatat: returned stat does not match Lstat")
if st2.Dev != st1.Dev {
t.Errorf("Fstatat: got dev %v, expected %v", st2.Dev, st1.Dev)
}
if st2.Ino != st1.Ino {
t.Errorf("Fstatat: got ino %v, expected %v", st2.Ino, st1.Ino)
}
if st2.Mode != st1.Mode {
t.Errorf("Fstatat: got mode %v, expected %v", st2.Mode, st1.Mode)
}
if st2.Uid != st1.Uid {
t.Errorf("Fstatat: got uid %v, expected %v", st2.Uid, st1.Uid)
}
if st2.Gid != st1.Gid {
t.Errorf("Fstatat: got gid %v, expected %v", st2.Gid, st1.Gid)
}
if st2.Size != st1.Size {
t.Errorf("Fstatat: got size %v, expected %v", st2.Size, st1.Size)
}
}