提交 0d664043 作者: Jeromy Johnson 提交者: GitHub

Merge pull request #3765 from ipfs/test/filestore/more-decriptive

test: fix 'disk_usage' returning number smaller by factor of 512 on BSD and Darvin
...@@ -343,15 +343,18 @@ disk_usage() { ...@@ -343,15 +343,18 @@ disk_usage() {
case $(uname -s) in case $(uname -s) in
Linux) Linux)
DU="du -sb" DU="du -sb"
M=1
;; ;;
FreeBSD) FreeBSD)
DU="du -s -A -B 1" DU="du -s -A -B 1"
M=512
;; ;;
Darwin | DragonFly | *) Darwin | DragonFly | *)
DU="du -s" DU="du -s"
M=512
;; ;;
esac esac
$DU "$1" | awk "{print \$1}" expr $($DU "$1" | awk "{print \$1}") "*" "$M"
} }
# output a file's permission in human readable format # output a file's permission in human readable format
......
...@@ -24,7 +24,7 @@ assert_repo_size_less_than() { ...@@ -24,7 +24,7 @@ assert_repo_size_less_than() {
test_expect_success "check repo size" ' test_expect_success "check repo size" '
test "$(get_repo_size)" -lt "$expval" || test "$(get_repo_size)" -lt "$expval" ||
test_fsh get_repo_size { echo should be bellow "$expval" && test_fsh get_repo_size; }
' '
} }
...@@ -33,7 +33,7 @@ assert_repo_size_greater_than() { ...@@ -33,7 +33,7 @@ assert_repo_size_greater_than() {
test_expect_success "check repo size" ' test_expect_success "check repo size" '
test "$(get_repo_size)" -gt "$expval" || test "$(get_repo_size)" -gt "$expval" ||
test_fsh get_repo_size { echo should be above "$expval" && test_fsh get_repo_size; }
' '
} }
...@@ -49,13 +49,13 @@ test_filestore_adds() { ...@@ -49,13 +49,13 @@ test_filestore_adds() {
assert_repo_size_less_than 1000000 assert_repo_size_less_than 1000000
test_expect_success "normal add with fscache doesnt duplicate data" ' 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 assert_repo_size_less_than 1000000
test_expect_success "normal add without fscache duplicates data" ' 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 assert_repo_size_greater_than 1000000
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论