core-lightning/tools/test/Makefile
Rusty Russell 573ce14509 tools: remove DEVELOPER.
We can now always enable developer using --developer.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-21 20:08:24 +09:30

59 lines
1.9 KiB
Makefile

#! /usr/bin/make
#
# Rudimentary tests for the wire parsers, using a set of test
# definitions. (Covers more of the test definitions)
#
# We generate the files, and then we attempt to compile
# and run a test case.
# We don't run these at all unless mako is installed.
ifeq ($(HAVE_PYTHON3_MAKO),1)
check-units: check-tools
TOOL_TEST_INCL_SRC := tools/test/enum.c
TOOL_GEN_SRC := tools/test/test_gen.c tools/test/print_gen.c
TOOL_GEN_OBJS := $(TOOL_GEN_SRC:.c=.o)
TOOL_GEN_HEADER := tools/test/test_gen.h tools/test/print_gen.h
TOOL_TEST_SRC := $(wildcard tools/test/run-*.c)
TOOL_TEST_OBJS := $(TOOL_TEST_SRC:.c=.o)
TOOL_TEST_PROGRAMS := $(TOOL_TEST_OBJS:.o=)
# Get dependencies correct
ALL_C_SOURCES += $(TOOL_GEN_SRC) $(TOOL_TEST_SRC)
ALL_C_HEADERS += $(TOOL_GEN_HEADER)
TOOL_TEST_COMMON_OBJS := \
common/utils.o \
wire/fromwire.o \
wire/towire.o
TOOLS_WIRE_DEPS := $(BOLT_DEPS) tools/test/test_cases $(wildcard tools/gen/*_template)
tools/test/enum.o: ccan/config.h
$(TOOL_TEST_OBJS) $(TOOL_GEN_OBJS): $(TOOL_GEN_HEADER)
$(TOOL_TEST_PROGRAMS): $(TOOL_TEST_COMMON_OBJS) $(TOOL_GEN_OBJS) tools/test/enum.o
tools/test/test_gen.h: $(TOOLS_WIRE_DEPS) tools/test/Makefile
$(BOLT_GEN) --page header $@ test_type < tools/test/test_cases > $@
tools/test/test_gen.c: $(TOOLS_WIRE_DEPS) tools/test/Makefile
$(BOLT_GEN) --page impl tools/test/test_gen.h test_type < tools/test/test_cases > $@
tools/test/print_gen.h: wire/onion_wiregen.h $(TOOLS_WIRE_DEPS)
$(BOLT_GEN) -P --page header $@ test_type < tools/test/test_cases > $@
tools/test/print_gen.c: $(TOOLS_WIRE_DEPS)
echo '#include "test_gen.h"' > $@
$(BOLT_GEN) -P --page impl ${@:.c=.h} test_type < tools/test/test_cases >> $@
ALL_TEST_PROGRAMS += $(TOOL_TEST_PROGRAMS)
check-tools: $(TOOL_TEST_PROGRAMS:%=unittest/%)
endif # HAVE_PYTHON3_MAKO
clean: tools-test-clean
tools-test-clean:
$(RM) $(TOOL_GEN_HEADER) $(TOOL_GEN_SRC) $(TOOL_TEST_OBJS) $(TOOL_TEST_PROGRAMS)
$(RM) $(TOOL_GEN_SRC:.c=.o) tools/test/enum.o