From 95db38912b4f796402d6f4e4e78c01e076a68570 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Tue, 4 Oct 2016 21:48:53 +0200 Subject: tests: fallocate: skip some disk usage checks on btrfs The expected allocated sizes are verified for tmpfs and ext4. btrfs gives different results, but that's not an error. Also, simplify test_helpers.Du and several code paths. Fixes #43. --- tests/test_helpers/helpers.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/test_helpers') diff --git a/tests/test_helpers/helpers.go b/tests/test_helpers/helpers.go index 5c71d30..be532df 100644 --- a/tests/test_helpers/helpers.go +++ b/tests/test_helpers/helpers.go @@ -312,12 +312,12 @@ func VerifyExistence(path string) bool { // Du returns the disk usage of the file "fd" points to, in bytes. // Same as "du --block-size=1". -func Du(t *testing.T, fd int) (nBytes int64, nBlocks int64) { +func Du(t *testing.T, fd int) (nBytes int64) { var st syscall.Stat_t err := syscall.Fstat(fd, &st) if err != nil { t.Fatal(err) } - // On OSX, Blksize is int32, need to cast to int64. - return st.Blocks * int64(st.Blksize), st.Blocks + // st.Blocks = number of 512-byte blocks + return st.Blocks * 512 } -- cgit v1.2.3