cln/wire/test/Makefile
Rusty Russell 1c925e0a25 common: add randbytes() wrapper to override cryptographic entropy: $CLN_DEV_ENTROPY_SEED
Only in developer mode, ofc.

Notes:
1. We have to move the initialization before the lightningd main trace_start,
   since that uses pseudorand().
2. To make the results stable, we need to use per-caller values to randbytes().
   Otherwise external timing changes the call order.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-07-13 18:15:06 -07:00

29 lines
1 KiB
Makefile

check-units: wire-tests
# Note that these actually #include everything they need, except ccan/ and bitcoin/.
# That allows for unit testing of statics, and special effects.
WIRE_TEST_SRC := $(wildcard wire/test/run-*.c)
WIRE_TEST_OBJS := $(WIRE_TEST_SRC:.c=.o)
WIRE_TEST_PROGRAMS := $(WIRE_TEST_OBJS:.o=)
ALL_C_SOURCES += $(WIRE_TEST_SRC)
ALL_TEST_PROGRAMS += $(WIRE_TEST_PROGRAMS)
WIRE_TEST_COMMON_OBJS := \
common/autodata.o \
common/base32.o \
common/pseudorand.o \
common/setup.o \
common/utils.o \
common/wireaddr.o
# run-tlvstream.c and run-peer-wire.c provide their own mocks for randbytes_ and randbytes_overridden
# run-tlvstream.c needs to reach into bitcoin/pubkey for SUPERVERBOSE
$(WIRE_TEST_PROGRAMS): $(WIRE_TEST_COMMON_OBJS) $(filter-out bitcoin/pubkey.o bitcoin/chainparams.o,$(BITCOIN_OBJS))
$(WIRE_TEST_OBJS): $(WIRE_HEADERS) $(WIRE_SRC) $(WIRE_PRINT_SRC) wire/test/Makefile
wire-tests: $(WIRE_TEST_PROGRAMS:%=unittest/%)
wire/test/run-peer-wire: wire/peer_wiregen.o common/bigsize.o