Browse Source

daemon/test/test.sh: add --valgrind and --gdb options.

We add a second to the sleep, as valgrind can be a little slow.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 9 years ago
parent
commit
6443629f6a
  1. 22
      daemon/test/test.sh

22
daemon/test/test.sh

@ -10,13 +10,29 @@ scripts/setup.sh
DIR1=/tmp/lightning.$$.1 DIR1=/tmp/lightning.$$.1
DIR2=/tmp/lightning.$$.2 DIR2=/tmp/lightning.$$.2
REDIR1="$DIR1/output"
REDIR2="$DIR2/output"
if [ x"$1" = x"--valgrind" ]; then
PREFIX1="valgrind --vgdb-error=1"
PREFIX2="valgrind --vgdb-error=1"
REDIR1="/dev/tty"
REDIR2="/dev/tty"
elif [ x"$1" = x"--gdb1" ]; then
PREFIX1="gdb --args -ex run"
REDIR1="/dev/tty"
elif [ x"$1" = x"--gdb2" ]; then
PREFIX2="gdb --args -ex run"
REDIR2="/dev/tty"
fi
LCLI1="../daemon/lightning-cli --lightning-dir=$DIR1" LCLI1="../daemon/lightning-cli --lightning-dir=$DIR1"
LCLI2="../daemon/lightning-cli --lightning-dir=$DIR2" LCLI2="../daemon/lightning-cli --lightning-dir=$DIR2"
trap "echo Results in $DIR1 and $DIR2" EXIT trap "echo Results in $DIR1 and $DIR2" EXIT
mkdir $DIR1 $DIR2 mkdir $DIR1 $DIR2
../daemon/lightningd --log-level=debug --lightning-dir=$DIR1 > $DIR1/output & $PREFIX1 ../daemon/lightningd --log-level=debug --lightning-dir=$DIR1 > $REDIR1 &
../daemon/lightningd --log-level=debug --lightning-dir=$DIR2 > $DIR2/output & $PREFIX2 ../daemon/lightningd --log-level=debug --lightning-dir=$DIR2 > $REDIR2 &
i=0 i=0
while ! $LCLI1 getlog | grep Hello; do while ! $LCLI1 getlog | grep Hello; do
@ -40,7 +56,7 @@ done
PORT2=`$LCLI2 getlog | sed -n 's/.*on port \([0-9]*\).*/\1/p'` PORT2=`$LCLI2 getlog | sed -n 's/.*on port \([0-9]*\).*/\1/p'`
$LCLI1 connect localhost $PORT2 999999 $LCLI1 connect localhost $PORT2 999999
sleep 1 sleep 2
# Expect them to be waiting for anchor. # Expect them to be waiting for anchor.
$LCLI1 getpeers | grep STATE_OPEN_WAITING_OURANCHOR $LCLI1 getpeers | grep STATE_OPEN_WAITING_OURANCHOR

Loading…
Cancel
Save