unix: don't check atime in TestStatx

On some builders TestStatx occassionally fails when comparing atime
between Statx and Stat/Lstat.

--- FAIL: TestStatx (0.00s)
	syscall_linux_test.go:365: Statx: returned stat atime does not match Lstat

Fix it by dropping the atime comparison, it's enough to verify Statx
working correctly by comparing ctime and mtime. Also, not all
filesystems support atime.

Change-Id: I7da68bd20b9b21274c4993aa2c4241395d2c933a
Reviewed-on: https://go-review.googlesource.com/114616
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Tobias Klauser
2018-05-25 15:55:20 +02:00
committed by Tobias Klauser
parent d4cedef346
commit c11f84a56e

View File

@@ -317,13 +317,9 @@ func TestStatx(t *testing.T) {
t.Errorf("Statx: returned stat mode does not match Stat")
}
atime := unix.StatxTimestamp{Sec: int64(st.Atim.Sec), Nsec: uint32(st.Atim.Nsec)}
ctime := unix.StatxTimestamp{Sec: int64(st.Ctim.Sec), Nsec: uint32(st.Ctim.Nsec)}
mtime := unix.StatxTimestamp{Sec: int64(st.Mtim.Sec), Nsec: uint32(st.Mtim.Nsec)}
if stx.Atime != atime {
t.Errorf("Statx: returned stat atime does not match Stat")
}
if stx.Ctime != ctime {
t.Errorf("Statx: returned stat ctime does not match Stat")
}
@@ -364,13 +360,9 @@ func TestStatx(t *testing.T) {
t.Errorf("Statx: returned stat mode does not match Lstat")
}
atime = unix.StatxTimestamp{Sec: int64(st.Atim.Sec), Nsec: uint32(st.Atim.Nsec)}
ctime = unix.StatxTimestamp{Sec: int64(st.Ctim.Sec), Nsec: uint32(st.Ctim.Nsec)}
mtime = unix.StatxTimestamp{Sec: int64(st.Mtim.Sec), Nsec: uint32(st.Mtim.Nsec)}
if stx.Atime != atime {
t.Errorf("Statx: returned stat atime does not match Lstat")
}
if stx.Ctime != ctime {
t.Errorf("Statx: returned stat ctime does not match Lstat")
}