@cryptotaxi247 / kubo / commits / e2ececa4f

test: fix sharness disk_usage util

on bsd based systems du returns block count not bytes License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

Jakub Sztandera committed Mar 7, 2017 at 23:50 UTC e2ececa4fa2aa63a3cc167e95f8e380c0178fee1
1 file changed +4 -1
test/sharness/lib/test-lib.sh
+4 -1
@@ -343,15 +343,18 @@ disk_usage() {
343 case $(uname -s) in
344 Linux)
345 DU="du -sb"
346 + M=1
347 ;;
348 FreeBSD)
349 DU="du -s -A -B 1"
350 + M=512
351 ;;
352 Darwin | DragonFly | *)
353 DU="du -s"
354 + M=512
355 ;;
356 esac
354 - $DU "$1" | awk "{print \$1}"
357 + expr $($DU "$1" | awk "{print \$1}") "*" "$M"
358 }
359
360 # output a file's permission in human readable format