summaryrefslogtreecommitdiff
path: root/tests/test_helpers/helpers.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-10-04 21:48:53 +0200
committerJakob Unterwurzacher2016-10-04 21:57:13 +0200
commit95db38912b4f796402d6f4e4e78c01e076a68570 (patch)
tree40d904035ef14e1637c60596307d1e864ea8338d /tests/test_helpers/helpers.go
parentdb72a4489d919760b6de3d4077f49348732f79c4 (diff)
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.
Diffstat (limited to 'tests/test_helpers/helpers.go')
-rw-r--r--tests/test_helpers/helpers.go6
1 files changed, 3 insertions, 3 deletions
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
}