Skip to content

Commit

Permalink
Merge pull request #3765 from ipfs/test/filestore/more-decriptive
Browse files Browse the repository at this point in the history
test: fix 'disk_usage' returning number smaller by factor of 512 on BSD and Darvin
  • Loading branch information
whyrusleeping authored Mar 9, 2017
2 parents 74afd87 + e2ececa commit 0d66404
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
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
8 changes: 4 additions & 4 deletions test/sharness/t0270-filestore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ assert_repo_size_less_than() {

test_expect_success "check repo size" '
test "$(get_repo_size)" -lt "$expval" ||
test_fsh get_repo_size
{ echo should be bellow "$expval" && test_fsh get_repo_size; }
'
}

Expand All @@ -33,7 +33,7 @@ assert_repo_size_greater_than() {

test_expect_success "check repo size" '
test "$(get_repo_size)" -gt "$expval" ||
test_fsh get_repo_size
{ echo should be above "$expval" && test_fsh get_repo_size; }
'
}

Expand All @@ -49,13 +49,13 @@ test_filestore_adds() {
assert_repo_size_less_than 1000000

test_expect_success "normal add with fscache doesnt duplicate data" '
HASH2=$(ipfs add --raw-leaves --fscache -r -q somedir | tail -n1)
ipfs add --raw-leaves --fscache -r -q somedir > /dev/null
'

assert_repo_size_less_than 1000000

test_expect_success "normal add without fscache duplicates data" '
HASH2=$(ipfs add --raw-leaves -r -q somedir | tail -n1)
ipfs add --raw-leaves -r -q somedir > /dev/null
'

assert_repo_size_greater_than 1000000
Expand Down

0 comments on commit 0d66404

Please sign in to comment.