Browse Source

lightningd/test: move some tests to common/ and channeld/

These unit tests stayed under lightningd/ even though the units they test
are elsewhere.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
plugin-6
Rusty Russell 6 years ago
committed by Christian Decker
parent
commit
a046af4416
  1. 3
      channeld/test/Makefile
  2. 7
      channeld/test/run-commit_tx.c
  3. 10
      channeld/test/run-full_channel.c
  4. 6
      common/test/run-funding_tx.c
  5. 4
      common/test/run-key_derive.c
  6. 1
      lightningd/test/Makefile
  7. 4
      lightningd/test/run-invoice-select-inchan.c

3
channeld/test/Makefile

@ -10,6 +10,9 @@ ALL_OBJS += $(CHANNELD_TEST_OBJS)
CHANNELD_TEST_COMMON_OBJS := \
common/daemon_conn.o \
common/htlc_state.o \
common/htlc_tx.o \
common/initial_commit_tx.o \
common/key_derive.o \
common/pseudorand.o \
common/msg_queue.o \
common/utils.o \

7
lightningd/test/run-commit_tx.c → channeld/test/run-commit_tx.c

@ -1,4 +1,3 @@
#include "../../common/key_derive.c"
#include <inttypes.h>
#include <stdio.h>
#include <common/type_to_string.h>
@ -6,15 +5,15 @@ static bool print_superverbose;
#define SUPERVERBOSE(...) \
do { if (print_superverbose) printf(__VA_ARGS__); } while(0)
#define PRINT_ACTUAL_FEE
#include "../../channeld/commit_tx.c"
#include "../../common/initial_commit_tx.c"
#include "../../common/htlc_tx.c"
#include "../commit_tx.c"
#include <bitcoin/preimage.h>
#include <bitcoin/privkey.h>
#include <bitcoin/pubkey.h>
#include <ccan/array_size/array_size.h>
#include <ccan/err/err.h>
#include <ccan/str/hex/hex.h>
#include <common/key_derive.h>
#include <common/status.h>
/* Turn this on to brute-force fee values */
/*#define DEBUG */

10
channeld/test/run-full_channel.c

@ -1,10 +1,7 @@
#include "../../common/key_derive.c"
#include "../../common/keyset.c"
#include "../../common/initial_channel.c"
#include "../../channeld/full_channel.c"
#include "../../common/initial_commit_tx.c"
#include "../../channeld/commit_tx.c"
#include "../../common/htlc_tx.c"
#include "../../common/keyset.c"
#include "../full_channel.c"
#include "../commit_tx.c"
#include <bitcoin/preimage.h>
#include <bitcoin/privkey.h>
#include <bitcoin/pubkey.h>
@ -13,6 +10,7 @@
#include <common/sphinx.h>
#include <common/type_to_string.h>
#include <stdio.h>
#include <wally_core.h>
void status_fmt(enum log_level level UNUSED, const char *fmt, ...)
{

6
lightningd/test/run-funding_tx.c → common/test/run-funding_tx.c

@ -9,9 +9,11 @@
#include <inttypes.h>
#include <stdio.h>
#define SUPERVERBOSE printf
#include "../../common/funding_tx.c"
#include "../funding_tx.c"
#undef SUPERVERBOSE
#include "../../common/key_derive.c"
#include "../key_derive.c"
#include "../type_to_string.c"
#include "../permute_tx.c"
#if 0
static struct sha256 sha256_from_hex(const char *hex)

4
lightningd/test/run-key_derive.c → common/test/run-key_derive.c

@ -2,10 +2,10 @@
#include <assert.h>
#include <ccan/str/hex/hex.h>
#include <common/type_to_string.h>
#include <common/utils.h>
#include <stdio.h>
#include "../../common/key_derive.c"
#include "../type_to_string.c"
#include "../key_derive.c"
static struct secret secret_from_hex(const char *hex)
{

1
lightningd/test/Makefile

@ -13,6 +13,7 @@ LIGHTNINGD_TEST_COMMON_OBJS := \
common/htlc_state.o \
common/io_lock.o \
common/json.o \
common/key_derive.o \
common/pseudorand.o \
common/memleak.o \
common/msg_queue.o \

4
lightningd/test/run-invoice-select-inchan.c

@ -6,10 +6,6 @@
bool deprecated_apis = false;
/* AUTOGENERATED MOCKS START */
/* Generated stub for bip32_pubkey */
bool bip32_pubkey(const struct ext_key *bip32_base UNNEEDED,
struct pubkey *pubkey UNNEEDED, u32 index UNNEEDED)
{ fprintf(stderr, "bip32_pubkey called!\n"); abort(); }
/* Generated stub for bitcoind_gettxout */
void bitcoind_gettxout(struct bitcoind *bitcoind UNNEEDED,
const struct bitcoin_txid *txid UNNEEDED, const u32 outnum UNNEEDED,

Loading…
Cancel
Save