From 0ccb4e82f8d5b79da9f32efd51a3bfb61a3d489e Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Tue, 7 Mar 2017 23:03:53 +0100 Subject: [PATCH 1/3] test: make the repo size check error message better License: MIT Signed-off-by: Jakub Sztandera --- test/sharness/t0270-filestore.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/sharness/t0270-filestore.sh b/test/sharness/t0270-filestore.sh index 2f5e2ec63cb..a72ea90ccc2 100755 --- a/test/sharness/t0270-filestore.sh +++ b/test/sharness/t0270-filestore.sh @@ -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; } ' } @@ -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; } ' } From afc0e77320d9aa4b78c53ee490df530712cf667b Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Tue, 7 Mar 2017 23:39:39 +0100 Subject: [PATCH 2/3] test: skip not necessary var assigment License: MIT Signed-off-by: Jakub Sztandera --- test/sharness/t0270-filestore.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/sharness/t0270-filestore.sh b/test/sharness/t0270-filestore.sh index a72ea90ccc2..7a54bfe44b2 100755 --- a/test/sharness/t0270-filestore.sh +++ b/test/sharness/t0270-filestore.sh @@ -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 From e2ececa4fa2aa63a3cc167e95f8e380c0178fee1 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Tue, 7 Mar 2017 23:50:19 +0100 Subject: [PATCH 3/3] test: fix sharness disk_usage util on bsd based systems du returns block count not bytes License: MIT Signed-off-by: Jakub Sztandera --- test/sharness/lib/test-lib.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/sharness/lib/test-lib.sh b/test/sharness/lib/test-lib.sh index 57cf2c04731..f556187b4fa 100644 --- a/test/sharness/lib/test-lib.sh +++ b/test/sharness/lib/test-lib.sh @@ -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