test: print output of commands which fail.

We capture the output in case we need to resubmit the command after restarting,
but we weren't printing it out on failure (set -e means we'd stop immediately).

As a side-effect of this change, we don't restart after failed
commands, which caused another bug: we were writing the 2->3 route to
the config file, but not restarting again, so we lost the route.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2016-08-30 20:10:57 +09:30
parent 7550ec23ec
commit 92187ae5e7

View file

@ -108,8 +108,12 @@ lcli1()
if [ -n "$VERBOSE" ]; then
echo $LCLI1 "$@" >&2
fi
$LCLI1 "$@"
STATUS=$?
# Make sure we output if it fails; we need to capture it otherwise.
if ! OUT=`$LCLI1 "$@"`; then
echo "$OUT"
return 1
fi
echo "$OUT"
if [ -n "$DO_RECONNECT" ]; then
case "$1" in
# Don't restart on every get* command.
@ -154,7 +158,6 @@ lcli1()
;;
esac
fi
return $STATUS
}
lcli2()
@ -939,9 +942,9 @@ if [ ! -n "$MANUALCOMMIT" ]; then
HTLC_AMOUNT=100000000
# Tell node 1 about the 2->3 route.
lcli1 add-route $ID2 $ID3 546000 10 36 36
# Add to config in case we are restaring.
echo "add-route=$ID2/$ID3/546000/10/36/36" >> $DIR1/config
lcli1 add-route $ID2 $ID3 546000 10 36 36
RHASH5=`lcli3 accept-payment $HTLC_AMOUNT | sed 's/.*"\([0-9a-f]*\)".*/\1/'`
# Try wrong hash.