Skip to content

Commit

Permalink
sharness: 2 space indent
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
  • Loading branch information
magik6k committed Sep 8, 2017
1 parent b6b1f6a commit 2838ffe
Show file tree
Hide file tree
Showing 83 changed files with 4,793 additions and 4,793 deletions.
38 changes: 19 additions & 19 deletions test/sharness/lib/install-sharness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,41 @@
version=5eee9b51b5621cec95a64018f0cc779963b230d2
urlprefix=https://github.com/mlafeldt/sharness.git
if test ! -n "$clonedir" ; then
clonedir=lib
clonedir=lib
fi
sharnessdir=sharness

if test -f "$clonedir/$sharnessdir/SHARNESS_VERSION_$version"
then
# There is the right version file. Great, we are done!
exit 0
# There is the right version file. Great, we are done!
exit 0
fi

die() {
echo >&2 "$@"
exit 1
echo >&2 "$@"
exit 1
}

checkout_version() {
git checkout "$version" || die "Could not checkout '$version'"
rm -f SHARNESS_VERSION_* || die "Could not remove 'SHARNESS_VERSION_*'"
touch "SHARNESS_VERSION_$version" || die "Could not create 'SHARNESS_VERSION_$version'"
echo "Sharness version $version is checked out!"
git checkout "$version" || die "Could not checkout '$version'"
rm -f SHARNESS_VERSION_* || die "Could not remove 'SHARNESS_VERSION_*'"
touch "SHARNESS_VERSION_$version" || die "Could not create 'SHARNESS_VERSION_$version'"
echo "Sharness version $version is checked out!"
}

if test -d "$clonedir/$sharnessdir/.git"
then
# We need to update sharness!
cd "$clonedir/$sharnessdir" || die "Could not cd into '$clonedir/$sharnessdir' directory"
git fetch || die "Could not fetch to update sharness"
checkout_version
# We need to update sharness!
cd "$clonedir/$sharnessdir" || die "Could not cd into '$clonedir/$sharnessdir' directory"
git fetch || die "Could not fetch to update sharness"
checkout_version
else
# We need to clone sharness!
mkdir -p "$clonedir" || die "Could not create '$clonedir' directory"
cd "$clonedir" || die "Could not cd into '$clonedir' directory"
# We need to clone sharness!
mkdir -p "$clonedir" || die "Could not create '$clonedir' directory"
cd "$clonedir" || die "Could not cd into '$clonedir' directory"

git clone "$urlprefix" || die "Could not clone '$urlprefix'"
cd "$sharnessdir" || die "Could not cd into '$sharnessdir' directory"
checkout_version
git clone "$urlprefix" || die "Could not clone '$urlprefix'"
cd "$sharnessdir" || die "Could not cd into '$sharnessdir' directory"
checkout_version
fi
exit 0
58 changes: 29 additions & 29 deletions test/sharness/lib/iptb-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,42 @@
export IPTB_ROOT="$(pwd)/.iptb"

ipfsi() {
dir="$1"
shift
IPFS_PATH="$IPTB_ROOT/$dir" ipfs "$@"
dir="$1"
shift
IPFS_PATH="$IPTB_ROOT/$dir" ipfs "$@"
}

check_has_connection() {
node="$1"
ipfsi "$node" swarm peers >"swarm_peers_$node" &&
grep "ipfs" "swarm_peers_$node" >/dev/null
node="$1"
ipfsi "$node" swarm peers >"swarm_peers_$node" &&
grep "ipfs" "swarm_peers_$node" >/dev/null
}

startup_cluster() {
num_nodes="$1"
shift
other_args="$@"
bound=$(expr "$num_nodes" - 1)
num_nodes="$1"
shift
other_args="$@"
bound=$(expr "$num_nodes" - 1)

if test -n "$other_args"; then
test_expect_success "start up nodes with additional args" '
iptb start --args $other_args
'
else
test_expect_success "start up nodes" '
iptb start
'
fi
if test -n "$other_args"; then
test_expect_success "start up nodes with additional args" '
iptb start --args $other_args
'
else
test_expect_success "start up nodes" '
iptb start
'
fi

test_expect_success "connect nodes to eachother" '
iptb connect [1-$bound] 0
'
test_expect_success "connect nodes to eachother" '
iptb connect [1-$bound] 0
'

for i in $(test_seq 0 "$bound")
do
test_expect_success "node $i is connected" '
check_has_connection "$i" ||
test_fsh cat "swarm_peers_$i"
'
done
for i in $(test_seq 0 "$bound")
do
test_expect_success "node $i is connected" '
check_has_connection "$i" ||
test_fsh cat "swarm_peers_$i"
'
done
}
6 changes: 3 additions & 3 deletions test/sharness/lib/test-aggregate-results.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
SHARNESS_AGGREGATE="lib/sharness/aggregate-results.sh"

test -f "$SHARNESS_AGGREGATE" || {
echo >&2 "Cannot find: $SHARNESS_AGGREGATE"
echo >&2 "Please check Sharness installation."
exit 1
echo >&2 "Cannot find: $SHARNESS_AGGREGATE"
echo >&2 "Please check Sharness installation."
exit 1
}

ls test-results/t*-*.sh.*.counts | "$SHARNESS_AGGREGATE"
Loading

0 comments on commit 2838ffe

Please sign in to comment.