Преглед на файлове

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>
Tobias Klauser преди 7 години
родител
ревизия
c11f84a56e
променени са 1 файла, в които са добавени 0 реда и са изтрити 8 реда
  1. 0 8
      unix/syscall_linux_test.go

+ 0 - 8
unix/syscall_linux_test.go

@@ -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")
 	}