From d36486aed7f63e9debc313ebca1594ad4b7f2c1b Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Thu, 29 Jun 2017 15:13:33 +0200 Subject: [PATCH] Print output addr on failed tx to help debug #147 --- tests/cli/basictx.sh | 2 +- tests/cli/common.sh | 8 ++++---- tests/cli/counter.sh | 4 ++-- tests/cli/ibc.sh | 6 +++--- tests/cli/restart.sh | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/cli/basictx.sh b/tests/cli/basictx.sh index 670e17c917..591b99d806 100755 --- a/tests/cli/basictx.sh +++ b/tests/cli/basictx.sh @@ -34,7 +34,7 @@ test01SendTx() { assertFalse "missing dest" "${CLIENT_EXE} tx send --amount=992mycoin --sequence=1" assertFalse "bad password" "echo foo | ${CLIENT_EXE} tx send --amount=992mycoin --sequence=1 --to=$RECV --name=$RICH" TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=992mycoin --sequence=1 --to=$RECV --name=$RICH) - txSucceeded $? "$TX" + txSucceeded $? "$TX" "$RECV" HASH=$(echo $TX | jq .hash | tr -d \") TX_HEIGHT=$(echo $TX | jq .height) diff --git a/tests/cli/common.sh b/tests/cli/common.sh index 11db683988..b4c553ff55 100644 --- a/tests/cli/common.sh +++ b/tests/cli/common.sh @@ -138,13 +138,13 @@ checkAccount() { return $? } -# XXX Ex Usage: txSucceeded $? "$TX" +# XXX Ex Usage: txSucceeded $? "$TX" "$RECIEVER" # Desc: Must be called right after the `tx` command, makes sure it got a success response txSucceeded() { - if (assertTrue "sent tx: $2" $1); then + if (assertTrue "sent tx ($3): $2" $1); then TX=$2 - assertEquals "good check: $TX" "0" $(echo $TX | jq .check_tx.code) - assertEquals "good deliver: $TX" "0" $(echo $TX | jq .deliver_tx.code) + assertEquals "good check ($3): $TX" "0" $(echo $TX | jq .check_tx.code) + assertEquals "good deliver ($3): $TX" "0" $(echo $TX | jq .deliver_tx.code) else return 1 fi diff --git a/tests/cli/counter.sh b/tests/cli/counter.sh index d8dc13cbe0..02b8ac44d6 100755 --- a/tests/cli/counter.sh +++ b/tests/cli/counter.sh @@ -34,7 +34,7 @@ test01SendTx() { assertFalse "missing dest" "${CLIENT_EXE} tx send --amount=992mycoin --sequence=1 2>/dev/null" assertFalse "bad password" "echo foo | ${CLIENT_EXE} tx send --amount=992mycoin --sequence=1 --to=$RECV --name=$RICH 2>/dev/null" TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=992mycoin --sequence=1 --to=$RECV --name=$RICH 2>/dev/null) - txSucceeded $? "$TX" + txSucceeded $? "$TX" "$RECV" HASH=$(echo $TX | jq .hash | tr -d \") TX_HEIGHT=$(echo $TX | jq .height) @@ -65,7 +65,7 @@ test03AddCount() { assertFalse "bad password" "echo hi | ${CLIENT_EXE} tx counter --amount=1000mycoin --sequence=2 --name=${RICH} 2>/dev/null" TX=$(echo qwertyuiop | ${CLIENT_EXE} tx counter --amount=10mycoin --sequence=2 --name=${RICH} --valid --countfee=5mycoin) - txSucceeded $? "$TX" + txSucceeded $? "$TX" "counter" HASH=$(echo $TX | jq .hash | tr -d \") TX_HEIGHT=$(echo $TX | jq .height) diff --git a/tests/cli/ibc.sh b/tests/cli/ibc.sh index 89e3091b0f..0ff92cadc4 100755 --- a/tests/cli/ibc.sh +++ b/tests/cli/ibc.sh @@ -92,7 +92,7 @@ test01SendIBCTx() { export BC_HOME=${CLIENT_1} TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=20002mycoin \ --sequence=1 --to=${CHAIN_ID_2}/${RECV} --name=$RICH) - txSucceeded $? "$TX" + txSucceeded $? "$TX" "${CHAIN_ID_2}/${RECV}" # an example to quit early if there is no point in more tests if [ $? != 0 ]; then echo "aborting!"; return 1; fi @@ -141,7 +141,7 @@ startRelay() { SENDER=$(getAddr $RICH) RES=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=100000mycoin \ --sequence=$1 --to=$RELAY_ADDR --name=$RICH) - txSucceeded $? "$RES" + txSucceeded $? "$RES" "$RELAY_ADDR" if [ $? != 0 ]; then echo "can't pay chain1!"; return 1; fi # Get paid on chain2 @@ -149,7 +149,7 @@ startRelay() { SENDER=$(getAddr $RICH) RES=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=100000mycoin \ --sequence=$2 --to=$RELAY_ADDR --name=$RICH) - txSucceeded $? "$RES" + txSucceeded $? "$RES" "$RELAY_ADDR" if [ $? != 0 ]; then echo "can't pay chain2!"; return 1; fi # Initialize the relay (register both chains) diff --git a/tests/cli/restart.sh b/tests/cli/restart.sh index 3407d9467b..758eeddb6e 100755 --- a/tests/cli/restart.sh +++ b/tests/cli/restart.sh @@ -20,7 +20,7 @@ test00PreRestart() { RECV=$(getAddr $POOR) TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=992mycoin --sequence=1 --to=$RECV --name=$RICH) - txSucceeded $? "$TX" + txSucceeded $? "$TX" "$RECV" HASH=$(echo $TX | jq .hash | tr -d \") TX_HEIGHT=$(echo $TX | jq .height) @@ -37,7 +37,7 @@ test01OnRestart() { RECV=$(getAddr $POOR) TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=10000mycoin --sequence=2 --to=$RECV --name=$RICH) - txSucceeded $? "$TX" + txSucceeded $? "$TX" "$RECV" if [ $? != 0 ]; then echo "can't make tx!"; return 1; fi HASH=$(echo $TX | jq .hash | tr -d \") @@ -51,7 +51,7 @@ test01OnRestart() { # last minute tx just at the block cut-off... TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=20000mycoin --sequence=3 --to=$RECV --name=$RICH) - txSucceeded $? "$TX" + txSucceeded $? "$TX" "$RECV" if [ $? != 0 ]; then echo "can't make second tx!"; return 1; fi # now we do a restart...