Browse Source

test: shellcheck

pull/408/head
Ethan Buchman 8 years ago
parent
commit
1fa6e7f3b1
5 changed files with 29 additions and 29 deletions
  1. +1
    -1
      test/persist/test.sh
  2. +19
    -19
      test/persist/test_failure_indices.sh
  3. +2
    -2
      test/run_test.sh
  4. +1
    -1
      test/test_cover.sh
  5. +6
    -6
      test/test_libs.sh

+ 1
- 1
test/persist/test.sh View File

@ -1,5 +1,5 @@
#! /bin/bash
cd $GOPATH/src/github.com/tendermint/tendermint
cd "$GOPATH/src/github.com/tendermint/tendermint"
bash ./test/persist/test_failure_indices.sh

+ 19
- 19
test/persist/test_failure_indices.sh View File

@ -3,7 +3,7 @@
export TMROOT=$HOME/.tendermint_persist
rm -rf $TMROOT
rm -rf "$TMROOT"
tendermint init
TM_CMD="tendermint node --log_level=debug" # &> tendermint_${name}.log"
@ -40,9 +40,9 @@ function start_procs(){
}
function kill_procs(){
kill -9 $PID_DUMMY $PID_TENDERMINT
wait $PID_DUMMY
wait $PID_TENDERMINT
kill -9 "$PID_DUMMY" "$PID_TENDERMINT"
wait "$PID_DUMMY"
wait "$PID_TENDERMINT"
}
@ -59,10 +59,10 @@ function send_txs(){
# send a bunch of txs over a few blocks
echo "Node is up, sending txs"
for i in `seq 1 5`; do
for j in `seq 1 100`; do
tx=`head -c 8 /dev/urandom | hexdump -ve '1/1 "%.2X"'`
curl -s $addr/broadcast_tx_async?tx=0x$tx &> /dev/null
for i in $(seq 1 5); do
for _ in $(seq 1 100); do
tx=$(head -c 8 /dev/urandom | hexdump -ve '1/1 "%.2X"')
curl -s "$addr/broadcast_tx_async?tx=0x$tx" &> /dev/null
done
sleep 1
done
@ -70,33 +70,33 @@ function send_txs(){
failsStart=0
fails=`grep -r "fail.Fail" --include \*.go . | wc -l`
failsEnd=$(($fails-1))
fails=$(grep -r "fail.Fail" --include \*.go . | wc -l)
failsEnd=$((fails-1))
for failIndex in `seq $failsStart $failsEnd`; do
for failIndex in $(seq $failsStart $failsEnd); do
echo ""
echo "* Test FailIndex $failIndex"
# test failure at failIndex
send_txs &
start_procs 1 $failIndex
start_procs 1 "$failIndex"
# tendermint should fail when it hits the fail index
kill -9 $PID_DUMMY
wait $PID_DUMMY
kill -9 "$PID_DUMMY"
wait "$PID_DUMMY"
start_procs 2
# wait for node to handshake and make a new block
addr="localhost:46657"
curl -s $addr/status > /dev/null
curl -s "$addr/status" > /dev/null
ERR=$?
i=0
while [ "$ERR" != 0 ]; do
sleep 1
curl -s $addr/status > /dev/null
curl -s "$addr/status" > /dev/null
ERR=$?
i=$(($i + 1))
i=$((i + 1))
if [[ $i == 10 ]]; then
echo "Timed out waiting for tendermint to start"
exit 1
@ -104,11 +104,11 @@ for failIndex in `seq $failsStart $failsEnd`; do
done
# wait for a new block
h1=`curl -s $addr/status | jq .result[1].latest_block_height`
h1=$(curl -s $addr/status | jq .result[1].latest_block_height)
h2=$h1
while [ "$h2" == "$h1" ]; do
sleep 1
h2=`curl -s $addr/status | jq .result[1].latest_block_height`
h2=$(curl -s $addr/status | jq .result[1].latest_block_height)
done
kill_procs


+ 2
- 2
test/run_test.sh View File

@ -1,9 +1,9 @@
#! /bin/bash
set -e
echo `pwd`
pwd
BRANCH=`git rev-parse --abbrev-ref HEAD`
BRANCH=$(git rev-parse --abbrev-ref HEAD)
echo "Current branch: $BRANCH"
bash test/test_cover.sh


+ 1
- 1
test/test_cover.sh View File

@ -5,7 +5,7 @@ PKGS=$(go list github.com/tendermint/tendermint/... | grep -v /vendor/)
set -e
echo "mode: atomic" > coverage.txt
for pkg in ${PKGS[@]}; do
go test -v -timeout 30m -race -coverprofile=profile.out -covermode=atomic $pkg
go test -v -timeout 30m -race -coverprofile=profile.out -covermode=atomic "$pkg"
if [ -f profile.out ]; then
tail -n +2 profile.out >> coverage.txt;
rm profile.out


+ 6
- 6
test/test_libs.sh View File

@ -18,30 +18,30 @@ LIBS_MAKE_TEST=(go-rpc go-wire abci)
for lib in "${LIBS_GO_TEST[@]}"; do
# checkout vendored version of lib
bash scripts/glide/checkout.sh $GLIDE $lib
bash scripts/glide/checkout.sh "$GLIDE" "$lib"
echo "Testing $lib ..."
go test -v --race github.com/tendermint/$lib/...
go test -v --race "github.com/tendermint/$lib/..."
if [[ "$?" != 0 ]]; then
echo "FAIL"
exit 1
fi
done
DIR=`pwd`
DIR=$(pwd)
for lib in "${LIBS_MAKE_TEST[@]}"; do
# checkout vendored version of lib
bash scripts/glide/checkout.sh $GLIDE $lib
bash scripts/glide/checkout.sh "$GLIDE" "$lib"
echo "Testing $lib ..."
cd $GOPATH/src/github.com/tendermint/$lib
cd "$GOPATH/src/github.com/tendermint/$lib"
make test
if [[ "$?" != 0 ]]; then
echo "FAIL"
exit 1
fi
cd $DIR
cd "$DIR"
done
echo ""


Loading…
Cancel
Save