|
|
@ -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 |
|
|
|