Unverified Commit 39f0f5f7 authored by Whyrusleeping's avatar Whyrusleeping Committed by GitHub

Merge pull request #4443 from ipfs/fix/4408

make repo size test pass deterministically
parents 2ee18fad ba680b10
......@@ -363,10 +363,31 @@ generic_stat() {
FreeBSD | Darwin | DragonFly)
_STAT="stat -f %Sp"
;;
*)
echo "unsupported OS" >&2
exit 1
;;
esac
$_STAT "$1" || echo "failed" # Avoid returning nothing.
}
# output a file's permission in human readable format
file_size() {
case $(uname -s) in
Linux)
_STAT="stat --format=%s"
;;
FreeBSD | Darwin | DragonFly)
_STAT="stat -f%z"
;;
*)
echo "unsupported OS" >&2
exit 1
;;
esac
$_STAT "$1"
}
test_check_peerid() {
peeridlen=$(echo "$1" | tr -dC "[:alnum:]" | wc -c | tr -d " ") &&
test "$peeridlen" = "46" || {
......
......@@ -15,14 +15,11 @@ test_expect_success "create symbolic link for IPFS_PATH" '
test_init_ipfs
# compare RepoSize when getting it directly vs via symbolic link
# ensure that the RepoSize is reasonable when checked via a symlink.
test_expect_success "'ipfs repo stat' RepoSize is correct with sym link" '
export IPFS_PATH="sym_link_target" &&
reposize_direct=$(ipfs repo stat | grep RepoSize | awk '\''{ print $2 }'\'') &&
export IPFS_PATH=".ipfs" &&
reposize_symlink=$(ipfs repo stat | grep RepoSize | awk '\''{ print $2 }'\'') &&
echo "reposize_symlink: $reposize_symlink; reposize_direct: $reposize_direct" &&
test $reposize_symlink -ge $reposize_direct
symlink_size=$(file_size .ipfs) &&
test "${reposize_symlink}" -gt "${symlink_size}"
'
test_done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment