Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
go-ipfs
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
ipfs
go-ipfs
Commits
39f0f5f7
Unverified
Commit
39f0f5f7
authored
Dec 3, 2017
by
Whyrusleeping
Committed by
GitHub
Dec 3, 2017
Browse files
Options
Downloads
Plain Diff
Merge pull request #4443 from ipfs/fix/4408
make repo size test pass deterministically
parents
2ee18fad
ba680b10
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/sharness/lib/test-lib.sh
+21
-0
21 additions, 0 deletions
test/sharness/lib/test-lib.sh
test/sharness/t0088-repo-stat-symlink.sh
+3
-6
3 additions, 6 deletions
test/sharness/t0088-repo-stat-symlink.sh
with
24 additions
and
6 deletions
test/sharness/lib/test-lib.sh
+
21
−
0
View file @
39f0f5f7
...
@@ -363,10 +363,31 @@ generic_stat() {
...
@@ -363,10 +363,31 @@ generic_stat() {
FreeBSD
|
Darwin
|
DragonFly
)
FreeBSD
|
Darwin
|
DragonFly
)
_STAT
=
"stat -f %Sp"
_STAT
=
"stat -f %Sp"
;;
;;
*
)
echo
"unsupported OS"
>
&2
exit
1
;;
esac
esac
$_STAT
"
$1
"
||
echo
"failed"
# Avoid returning nothing.
$_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
()
{
test_check_peerid
()
{
peeridlen
=
$(
echo
"
$1
"
|
tr
-dC
"[:alnum:]"
|
wc
-c
|
tr
-d
" "
)
&&
peeridlen
=
$(
echo
"
$1
"
|
tr
-dC
"[:alnum:]"
|
wc
-c
|
tr
-d
" "
)
&&
test
"
$peeridlen
"
=
"46"
||
{
test
"
$peeridlen
"
=
"46"
||
{
...
...
This diff is collapsed.
Click to expand it.
test/sharness/t0088-repo-stat-symlink.sh
+
3
−
6
View file @
39f0f5f7
...
@@ -15,14 +15,11 @@ test_expect_success "create symbolic link for IPFS_PATH" '
...
@@ -15,14 +15,11 @@ test_expect_success "create symbolic link for IPFS_PATH" '
test_init_ipfs
test_init_ipfs
#
compare RepoSize when getting it directly vs
via sym
bolic
link
#
ensure that the RepoSize is reasonable when checked
via
a
symlink
.
test_expect_success
"'ipfs repo stat' RepoSize is correct with sym link"
'
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 }'
\'
') &&
reposize_symlink=$(ipfs repo stat | grep RepoSize | awk '
\'
'{ print $2 }'
\'
') &&
echo "reposize_symlink: $reposize_symlink; reposize_direct: $reposize_direct"
&&
symlink_size=$(file_size .ipfs)
&&
test
$
reposize_symlink -g
e $reposize_direct
test
"${
reposize_symlink
}"
-g
t "${symlink_size}"
'
'
test_done
test_done
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment