You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
3.2 KiB
64 lines
3.2 KiB
check: daemon-tests
|
|
|
|
daemon-test.sh-%:
|
|
daemon/test/scripts/shutdown.sh 2>/dev/null || true
|
|
NO_VALGRIND=$(NO_VALGRIND) daemon/test/test.sh --$*
|
|
|
|
# These don't work in parallel, so chain the deps
|
|
daemon-test.sh-steal: daemon-test.sh-dump-onchain
|
|
daemon-test.sh-dump-onchain: daemon-test.sh-timeout-anchor
|
|
daemon-test.sh-timeout-anchor: daemon-test.sh-different-fee-rates
|
|
daemon-test.sh-different-fee-rates: daemon-test.sh-normal
|
|
daemon-test.sh-normal: daemon-test.sh-manual-commit
|
|
daemon-test.sh-manual-commit: daemon-test.sh-mutual-close-with-htlcs
|
|
daemon-test.sh-mutual-close-with-htlcs: daemon-test.sh-steal\ --reconnect
|
|
daemon-test.sh-steal\ --reconnect: daemon-test.sh-dump-onchain\ --reconnect
|
|
daemon-test.sh-dump-onchain\ --reconnect: daemon-test.sh-timeout-anchor\ --reconnect
|
|
daemon-test.sh-timeout-anchor\ --reconnect: daemon-test.sh-different-fee-rates\ --reconnect
|
|
daemon-test.sh-different-fee-rates\ --reconnect: daemon-test.sh-normal\ --reconnect
|
|
daemon-test.sh-normal\ --reconnect: daemon-test.sh-manual-commit\ --reconnect
|
|
daemon-test.sh-manual-commit\ --reconnect: daemon-test.sh-mutual-close-with-htlcs\ --reconnect
|
|
daemon-test.sh-mutual-close-with-htlcs\ --reconnect: daemon-test.sh-steal\ --restart
|
|
daemon-test.sh-steal\ --restart: daemon-test.sh-dump-onchain\ --restart
|
|
daemon-test.sh-dump-onchain\ --restart: daemon-test.sh-timeout-anchor\ --restart
|
|
daemon-test.sh-timeout-anchor\ --restart: daemon-test.sh-different-fee-rates\ --restart
|
|
daemon-test.sh-different-fee-rates\ --restart: daemon-test.sh-normal\ --restart
|
|
daemon-test.sh-normal\ --restart: daemon-test.sh-mutual-close-with-htlcs\ --restart
|
|
daemon-test.sh-mutual-close-with-htlcs\ --restart: daemon-all
|
|
daemon-all-test.sh: daemon-test.sh-steal
|
|
|
|
# Note that these actually #include everything they need, except ccan/ and bitcoin/.
|
|
# That allows for unit testing of statics, and special effects.
|
|
DAEMON_TEST_SRC := $(wildcard daemon/test/run-*.c)
|
|
DAEMON_TEST_OBJS := $(DAEMON_TEST_SRC:.c=.o)
|
|
DAEMON_TEST_PROGRAMS := $(DAEMON_TEST_OBJS:.o=)
|
|
|
|
update-mocks-daemon/test/%: daemon/test/%
|
|
@set -e; trap "rm -f mocktmp.$*.*" EXIT; \
|
|
START=`fgrep -n '/* AUTOGENERATED MOCKS START */' $< | cut -d: -f1`;\
|
|
END=`fgrep -n '/* AUTOGENERATED MOCKS END */' $< | cut -d: -f1`; \
|
|
if [ -n "$$START" ]; then \
|
|
echo $<: ; \
|
|
head -n $$START $< > mocktmp.$*.new; \
|
|
(cat mocktmp.$*.new; tail -n +$$END $<) > mocktmp.$*.test.c; \
|
|
if ! $(CC) $(CFLAGS) mocktmp.$*.test.c -o mocktmp.$*.out $(HELPER_OBJS) $(CCAN_OBJS) $(LDLIBS) 2>mocktmp.$*.err; then \
|
|
daemon/test/scripts/mockup.sh < mocktmp.$*.err >> mocktmp.$*.new; \
|
|
sed -n 's,.*Generated stub for \(.*\) .*,\t\1,p' < mocktmp.$*.new; \
|
|
fi; \
|
|
tail -n +$$END $< >> mocktmp.$*.new; mv mocktmp.$*.new $<; \
|
|
fi
|
|
|
|
update-mocks: $(DAEMON_TEST_SRC:%=update-mocks-%)
|
|
|
|
$(DAEMON_TEST_PROGRAMS): $(CCAN_OBJS) $(BITCOIN_OBJS) libsecp256k1.a utils.o
|
|
|
|
$(DAEMON_TEST_OBJS): $(CCAN_HEADERS) $(DAEMON_HEADERS) $(DAEMON_SRC)
|
|
|
|
VALGRIND=valgrind -q --error-exitcode=99
|
|
VALGRIND_TEST_ARGS = --track-origins=yes --leak-check=full --show-reachable=yes
|
|
|
|
daemon-unit-tests: $(DAEMON_TEST_PROGRAMS)
|
|
set -e; for f in $(DAEMON_TEST_PROGRAMS); do $(VALGRIND) $(VALGRIND_TEST_ARGS) $$f; done
|
|
|
|
daemon-tests: daemon-unit-tests daemon-all-test.sh
|
|
|
|
|