From 0b19e637c986f602dad95be2570b2bd125677714 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Thu, 16 Feb 2017 19:37:10 +0100 Subject: 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 --- tests/matrix/atime_darwin.go | 9 +++++++++ tests/matrix/atime_linux.go | 9 +++++++++ tests/matrix/matrix_test.go | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 tests/matrix/atime_darwin.go create mode 100644 tests/matrix/atime_linux.go (limited to 'tests') diff --git a/tests/matrix/atime_darwin.go b/tests/matrix/atime_darwin.go new file mode 100644 index 0000000..5f89c69 --- /dev/null +++ b/tests/matrix/atime_darwin.go @@ -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} +} diff --git a/tests/matrix/atime_linux.go b/tests/matrix/atime_linux.go new file mode 100644 index 0000000..fb7b94f --- /dev/null +++ b/tests/matrix/atime_linux.go @@ -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} +} diff --git a/tests/matrix/matrix_test.go b/tests/matrix/matrix_test.go index 9bb5bac..8508e5b 100644 --- a/tests/matrix/matrix_test.go +++ b/tests/matrix/matrix_test.go @@ -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) } -- cgit v1.2.3