Skip to content

Commit

Permalink
test: fix sharness disk_usage util
Browse files Browse the repository at this point in the history
on bsd based systems du returns block count not bytes

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
  • Loading branch information
Kubuxu committed Mar 7, 2017
1 parent afc0e77 commit e2ececa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/sharness/lib/test-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -343,15 +343,18 @@ disk_usage() {
case $(uname -s) in
Linux)
DU="du -sb"
M=1
;;
FreeBSD)
DU="du -s -A -B 1"
M=512
;;
Darwin | DragonFly | *)
DU="du -s"
M=512
;;
esac
$DU "$1" | awk "{print \$1}"
expr $($DU "$1" | awk "{print \$1}") "*" "$M"
}

# output a file's permission in human readable format
Expand Down

0 comments on commit e2ececa

Please sign in to comment.