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.
86 lines
4.2 KiB
86 lines
4.2 KiB
check: daemon-tests
|
|
|
|
# We run three different bitcoinds, for different types of tests.
|
|
# Provides limited paralellism.
|
|
daemon-test.sh-0-%:
|
|
NO_VALGRIND=$(NO_VALGRIND) VARIANT=0 daemon/test/test.sh --$*
|
|
daemon-test.sh-1-%:
|
|
NO_VALGRIND=$(NO_VALGRIND) VARIANT=1 daemon/test/test.sh --$*
|
|
daemon-test.sh-2-%:
|
|
NO_VALGRIND=$(NO_VALGRIND) VARIANT=2 daemon/test/test.sh --$*
|
|
|
|
# These don't work in parallel, so chain the deps
|
|
daemon-test.sh-0-steal: daemon-test.sh-0-dump-onchain
|
|
daemon-test.sh-0-dump-onchain: daemon-test.sh-0-timeout-anchor
|
|
daemon-test.sh-0-timeout-anchor: daemon-test.sh-0-different-fee-rates
|
|
daemon-test.sh-0-different-fee-rates: daemon-test.sh-0-mutual-close-with-htlcs
|
|
daemon-test.sh-0-mutual-close-with-htlcs: daemon-test.sh-0-manual-commit
|
|
daemon-test.sh-0-manual-commit: daemon-test.sh-0-normal
|
|
daemon-test.sh-0-normal: daemon-test-setup-0
|
|
|
|
daemon-test.sh-1-steal\ --restart: daemon-test.sh-1-dump-onchain\ --restart
|
|
daemon-test.sh-1-dump-onchain\ --restart: daemon-test.sh-1-timeout-anchor\ --restart
|
|
daemon-test.sh-1-timeout-anchor\ --restart: daemon-test.sh-1-different-fee-rates\ --restart
|
|
daemon-test.sh-1-different-fee-rates\ --restart: daemon-test.sh-1-mutual-close-with-htlcs\ --restart
|
|
daemon-test.sh-1-mutual-close-with-htlcs\ --restart: daemon-test.sh-1-manual-commit\ --restart
|
|
daemon-test.sh-1-manual-commit\ --restart: daemon-test.sh-1-normal\ --restart
|
|
daemon-test.sh-1-normal\ --restart: daemon-test-setup-1
|
|
|
|
daemon-test.sh-2-steal\ --reconnect: daemon-test.sh-2-dump-onchain\ --reconnect
|
|
daemon-test.sh-2-dump-onchain\ --reconnect: daemon-test.sh-2-timeout-anchor\ --reconnect
|
|
daemon-test.sh-2-timeout-anchor\ --reconnect: daemon-test.sh-2-different-fee-rates\ --reconnect
|
|
daemon-test.sh-2-different-fee-rates\ --reconnect: daemon-test.sh-2-mutual-close-with-htlcs\ --reconnect
|
|
daemon-test.sh-2-mutual-close-with-htlcs\ --reconnect: daemon-test.sh-2-manual-commit\ --reconnect
|
|
daemon-test.sh-2-manual-commit\ --reconnect: daemon-test.sh-2-normal\ --reconnect
|
|
daemon-test.sh-2-normal\ --reconnect: daemon-test-setup-2
|
|
|
|
# We shutdown first in case something is left over.
|
|
daemon-test-setup-%: daemon-all
|
|
VARIANT=$* daemon/test/scripts/shutdown.sh 2>/dev/null || true
|
|
VARIANT=$* daemon/test/scripts/setup.sh
|
|
|
|
daemon-test-shutdown-0: daemon-test.sh-0-steal
|
|
VARIANT=0 daemon/test/scripts/shutdown.sh
|
|
daemon-test-shutdown-1: daemon-test.sh-1-steal\ --restart
|
|
VARIANT=1 daemon/test/scripts/shutdown.sh
|
|
daemon-test-shutdown-2: daemon-test.sh-2-steal\ --reconnect
|
|
VARIANT=2 daemon/test/scripts/shutdown.sh
|
|
|
|
# Forms long dependency chains.
|
|
daemon-all-test.sh: daemon-test-shutdown-0 daemon-test-shutdown-1 daemon-test-shutdown-2
|
|
|
|
# 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): $(DAEMON_HEADERS) $(DAEMON_JSMN_HEADERS) $(BITCOIN_HEADERS) $(CORE_HEADERS) $(GEN_HEADERS) $(DAEMON_GEN_HEADERS) $(CCAN_HEADERS)
|
|
|
|
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
|
|
|
|
|