tests: OSX compat: wrap Stat_t atime extract

Linux has st.Atim, st.Mtim,
OSX hat st.Atimespec, st.Mtimespec.

Reported at https://github.com/rfjakob/gocryptfs/issues/15#issuecomment-279130217
This commit is contained in:
Jakob Unterwurzacher 2017-02-16 19:37:10 +01:00
parent 8bbc1038fe
commit 0b19e637c9
3 changed files with 19 additions and 1 deletions

View File

@ -0,0 +1,9 @@
package matrix
import (
"syscall"
)
func extractAtimeMtime(st syscall.Stat_t) [2]syscall.Timespec {
return [2]syscall.Timespec{st.Atimespec, st.Mtimespec}
}

View File

@ -0,0 +1,9 @@
package matrix
import (
"syscall"
)
func extractAtimeMtime(st syscall.Stat_t) [2]syscall.Timespec {
return [2]syscall.Timespec{st.Atim, st.Mtim}
}

View File

@ -725,7 +725,7 @@ func doTestUtimesNano(t *testing.T, path string) {
if err != nil {
t.Fatal(err)
}
err = compareUtimes(tc.out, [2]syscall.Timespec{st.Atim, st.Mtim})
err = compareUtimes(tc.out, extractAtimeMtime(st))
if err != nil {
t.Errorf("Testcase %d: %v", i, err)
}