mirror of
https://github.com/golang/sys.git
synced 2026-02-08 19:56:04 +03:00
unix: fix TestStatFieldNames on aix and TestUtimesNanoAt on darwin
Following CL 175157 which renames Stat_t time fields to [AMCB]tim. Updates golang/go#31735 Change-Id: I0791c59bab307d237b315c1b919265902f7d9917 Reviewed-on: https://go-review.googlesource.com/c/sys/+/177437 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
87c872767d
commit
cab07311ab
@@ -50,15 +50,15 @@ func TestUtimesNanoAt(t *testing.T) {
|
||||
t.Fatalf("Lstat: %v", err)
|
||||
}
|
||||
|
||||
// Only check Mtimespec, Atimespec might not be supported by the underlying filesystem
|
||||
// Only check Mtim, Atim might not be supported by the underlying filesystem
|
||||
expected := ts[1]
|
||||
if st.Mtimespec.Nsec == 0 {
|
||||
if st.Mtim.Nsec == 0 {
|
||||
// Some filesystems only support 1-second time stamp resolution
|
||||
// and will always set Nsec to 0.
|
||||
expected.Nsec = 0
|
||||
}
|
||||
if st.Mtimespec != expected {
|
||||
t.Errorf("UtimesNanoAt: wrong mtime: got %v, expected %v", st.Mtimespec, expected)
|
||||
if st.Mtim != expected {
|
||||
t.Errorf("UtimesNanoAt: wrong mtime: got %v, expected %v", st.Mtim, expected)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,9 +62,13 @@ func TestUname(t *testing.T) {
|
||||
// Test that this compiles. (Issue #31735)
|
||||
func TestStatFieldNames(t *testing.T) {
|
||||
var st unix.Stat_t
|
||||
var ts *unix.Timespec
|
||||
var ts interface{} // either *unix.Timespec or *unix.StTimespec on GOOS==aix
|
||||
ts = &st.Atim
|
||||
ts = &st.Mtim
|
||||
ts = &st.Ctim
|
||||
_ = ts
|
||||
secs := int64(st.Mtim.Sec)
|
||||
nsecs := int64(st.Mtim.Nsec)
|
||||
_ = secs
|
||||
_ = nsecs
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user