Browse Source

daemon/test/scripts: maek slightly more general for lightningd/lightningd

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 8 years ago
parent
commit
e39d09d5a5
  1. 14
      daemon/test/scripts/helpers.sh
  2. 1
      daemon/test/test-basic
  3. 1
      daemon/test/test-different-fees
  4. 1
      daemon/test/test-funding-timeout
  5. 1
      daemon/test/test-invoice
  6. 1
      daemon/test/test-mutual-close-with-htlcs
  7. 1
      daemon/test/test-routing
  8. 1
      daemon/test/test-steal
  9. 1
      daemon/test/test-unilateral

14
daemon/test/scripts/helpers.sh

@ -122,12 +122,12 @@ EOF
[ $NUM_LIGHTNINGD = 2 ] || echo port=`findport 4010 $VARIANT` >> $DIR3/config
}
# Use DIR REDIR REDIRERR GDBFLAG
# Use DIR REDIR REDIRERR GDBFLAG BINARY
start_one_lightningd()
{
# Need absolute path for re-exec testing.
local CMD
CMD="$(readlink -f `pwd`/../lightningd) --lightning-dir=$1"
CMD="$(readlink -f `pwd`/../../$5) --lightning-dir=$1"
if [ -n "$4" ]; then
echo Press return once you run: gdb --args $CMD >&2
@ -142,6 +142,7 @@ start_one_lightningd()
start_lightningd()
{
NUM_LIGHTNINGD=$1
BINARY=${2:-daemon/lightningd}
# If bitcoind not already running, start it.
if ! $CLI getinfo >/dev/null 2>&1; then
@ -152,9 +153,9 @@ start_lightningd()
SHUTDOWN_BITCOIN=/bin/true
fi
LIGHTNINGD1=`start_one_lightningd $DIR1 $REDIR1 $REDIRERR1 "$GDB1"`
LIGHTNINGD2=`start_one_lightningd $DIR2 $REDIR2 $REDIRERR2 "$GDB2"`
[ $NUM_LIGHTNINGD = 2 ] || LIGHTNINGD3=`start_one_lightningd $DIR3 $REDIR3 $REDIRERR3 "$GDB3"`
LIGHTNINGD1=`start_one_lightningd $DIR1 $REDIR1 $REDIRERR1 "$GDB1" $BINARY`
LIGHTNINGD2=`start_one_lightningd $DIR2 $REDIR2 $REDIRERR2 "$GDB2" $BINARY`
[ $NUM_LIGHTNINGD = 2 ] || LIGHTNINGD3=`start_one_lightningd $DIR3 $REDIR3 $REDIRERR3 "$GDB3" $BINARY`
if ! check "$LCLI1 getlog 2>/dev/null | $FGREP Hello"; then
echo Failed to start daemon 1 >&2
@ -186,7 +187,10 @@ start_lightningd()
PORT2=`get_info_field "$LCLI2" port`
[ $NUM_LIGHTNINGD = 2 ] || PORT3=`get_info_field "$LCLI3" port`
}
fund_lightningd()
{
# Make a payment into a P2SH for anchor.
P2SHADDR=`$LCLI1 newaddr | sed -n 's/{ "address" : "\(.*\)" }/\1/p'`
FUND_INPUT_TXID=`$CLI sendtoaddress $P2SHADDR 0.01`

1
daemon/test/test-basic

@ -21,6 +21,7 @@ if [ -n "$MANUALCOMMIT" ]; then
fi
start_lightningd 2
fund_lightningd
# Check IDs match logs
[ `$LCLI1 getlog | sed -n 's/.*"ID: \([0-9a-f]*\)".*/\1/p'` = $ID1 ]

1
daemon/test/test-different-fees

@ -16,6 +16,7 @@ FEE_RATE2=$(($DEFAULT_FEE_RATE2 * 5))
echo "default-fee-rate=$DEFAULT_FEE_RATE2" >> $DIR2/config
start_lightningd 2
fund_lightningd
lcli1 connect localhost $PORT2 $FUND_INPUT_TX &

1
daemon/test/test-funding-timeout

@ -9,6 +9,7 @@ cd `git rev-parse --show-toplevel`/daemon/test
parse_cmdline 2 "$@"
setup_lightning 2
start_lightningd 2
fund_lightningd
# Prevent anchor broadcast
lcli1 dev-broadcast false

1
daemon/test/test-invoice

@ -9,6 +9,7 @@ cd `git rev-parse --show-toplevel`/daemon/test
parse_cmdline 2 "$@"
setup_lightning 2
start_lightningd 2
fund_lightningd
lcli1 connect localhost $PORT2 $FUND_INPUT_TX &

1
daemon/test/test-mutual-close-with-htlcs

@ -9,6 +9,7 @@ cd `git rev-parse --show-toplevel`/daemon/test
parse_cmdline 2 "$@"
setup_lightning 2
start_lightningd 2
fund_lightningd
lcli1 connect localhost $PORT2 $FUND_INPUT_TX &

1
daemon/test/test-routing

@ -9,6 +9,7 @@ cd `git rev-parse --show-toplevel`/daemon/test
parse_cmdline 3 "$@"
setup_lightning 3
start_lightningd 3
fund_lightningd
# We connect 1->2->3
lcli1 connect localhost $PORT2 $FUND_INPUT_TX &

1
daemon/test/test-steal

@ -9,6 +9,7 @@ cd `git rev-parse --show-toplevel`/daemon/test
parse_cmdline 2 "$@"
setup_lightning 2
start_lightningd 2
fund_lightningd
lcli1 connect localhost $PORT2 $FUND_INPUT_TX &

1
daemon/test/test-unilateral

@ -9,6 +9,7 @@ cd `git rev-parse --show-toplevel`/daemon/test
parse_cmdline 2 "$@"
setup_lightning 2
start_lightningd 2
fund_lightningd
lcli1 connect localhost $PORT2 $FUND_INPUT_TX &

Loading…
Cancel
Save