daemon: test scripts.

We comment out the peer_create_close_tx() abort for now, so we
can test.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2016-01-22 06:45:27 +10:30
parent 3c9fd4fbe6
commit f5538bd1d2
3 changed files with 66 additions and 2 deletions

View File

@ -203,8 +203,9 @@ $(HELPER_OBJS) $(BITCOIN_OBJS) $(TEST_CLI_PROGRAMS:=.o) $(TEST_PROGRAMS:=.o): $(
$(TEST_CLI_PROGRAMS:=.o): $(TEST_CLI_HEADERS)
# These don't work in parallel, so we open-code them
test-cli-tests: $(TEST_CLI_PROGRAMS)
test-cli-tests: $(TEST_CLI_PROGRAMS) daemon-all
cd test-cli; scripts/shutdown.sh 2>/dev/null || true
set -e; for args in ""; do daemon/test/test.sh; done
set -e; cd test-cli; for args in "" --steal --unilateral --htlc-onchain; do scripts/setup.sh && scripts/test.sh $$args && scripts/shutdown.sh; done
test-onion: test/test_onion test/onion_key

View File

@ -594,7 +594,7 @@ void peer_watch_htlc_spend(struct peer *peer,
const struct htlc *htlc,
enum state_input done)
{
FIXME_STUB(peer);
/* FIXME! */
}
void peer_unwatch_htlc_spend(struct peer *peer,
const struct htlc *htlc,

63
daemon/test/test.sh Executable file
View File

@ -0,0 +1,63 @@
#! /bin/sh -e
# We steal the test-cli scripts.
cd test-cli
. scripts/vars.sh
scripts/setup.sh
DIR1=/tmp/lightning.$$.1
DIR2=/tmp/lightning.$$.2
LCLI1="../daemon/lightning-cli --lightning-dir=$DIR1"
LCLI2="../daemon/lightning-cli --lightning-dir=$DIR2"
trap "echo Results in $DIR1 and $DIR2" EXIT
mkdir $DIR1 $DIR2
../daemon/lightningd --log-level=debug --lightning-dir=$DIR1 > $DIR1/output &
../daemon/lightningd --log-level=debug --lightning-dir=$DIR2 > $DIR2/output &
i=0
while ! $LCLI1 getlog | grep Hello; do
sleep 1
i=$(($i + 1))
if [ $i -gt 10 ]; then
echo Failed to start daemon 1 >&2
exit 1
fi
done
while ! $LCLI2 getlog | grep 'listener on port'; do
sleep 1
i=$(($i + 1))
if [ $i -gt 10 ]; then
echo Failed to start daemon 2 >&2
exit 1
fi
done
PORT2=`$LCLI2 getlog | sed -n 's/.*on port \([0-9]*\).*/\1/p'`
$LCLI1 connect localhost $PORT2 999999
sleep 1
# Expect them to be waiting for anchor.
$LCLI1 getpeers | grep STATE_OPEN_WAITING_OURANCHOR
$LCLI2 getpeers | grep STATE_OPEN_WAITING_THEIRANCHOR
# Now make it pass anchor.
$CLI generate 3
# FIXME: Speed this up!
sleep 30
$LCLI1 getpeers | grep STATE_NORMAL_HIGHPRIO
$LCLI2 getpeers | grep STATE_NORMAL_LOWPRIO
$LCLI1 stop
$LCLI2 stop
scripts/shutdown.sh
trap "rm -rf $DIR1 $DIR2" EXIT