bolt-gen: fixup the devtool/decodemsg printing facility
Fixup TLV handling in the bolt printing utility, `devtools/decodemsg`
This commit is contained in:
committed by
Rusty Russell
parent
cedebfd2d9
commit
281b4c241e
@@ -7,8 +7,8 @@
|
||||
# and run a test case.
|
||||
check-units: check-tools
|
||||
|
||||
TOOL_GEN_SRC := tools/test/gen_test.c
|
||||
TOOL_GEN_HEADER := tools/test/gen_test.h
|
||||
TOOL_GEN_SRC := tools/test/gen_test.c tools/test/gen_print.c
|
||||
TOOL_GEN_HEADER := tools/test/gen_test.h tools/test/gen_print.h
|
||||
TOOL_TEST_SRC := $(wildcard tools/test/run-*.c)
|
||||
TOOL_TEST_OBJS := $(TOOL_TEST_SRC:.c=.o)
|
||||
TOOL_TEST_PROGRAMS := $(TOOL_TEST_OBJS:.o=)
|
||||
@@ -18,9 +18,9 @@ TOOL_TEST_COMMON_OBJS := \
|
||||
|
||||
TOOLS_WIRE_DEPS := $(BOLT_DEPS) tools/test/test_cases $(wildcard tools/gen/*_template)
|
||||
|
||||
$(TOOL_TEST_SRC): $(TOOL_GEN_HEADER)
|
||||
$(TOOL_TEST_SRC) $(TOOL_GEN_SRC): $(TOOL_GEN_HEADER)
|
||||
$(TOOL_TEST_OBJS): $(TOOL_GEN_SRC)
|
||||
$(TOOL_TEST_PROGRAMS): $(TOOL_TEST_COMMON_OBJS) tools/test/gen_test.o
|
||||
$(TOOL_TEST_PROGRAMS): $(TOOL_TEST_COMMON_OBJS) $(TOOL_GEN_SRC:.c=.o)
|
||||
$(TOOL_GEN_SRC) $(TOOL_GEN_HEADER): $(TOOLS_WIRE_DEPS)
|
||||
|
||||
tools/test/gen_test.h:
|
||||
@@ -30,11 +30,23 @@ tools/test/gen_test.c:
|
||||
tools/generate-bolts.py --page impl ${@:.c=.h} test_type < tools/test/test_cases > $@
|
||||
@tools/update-mocks.sh "$@"
|
||||
|
||||
tools/test/gen_print.h: wire/gen_onion_wire.h
|
||||
tools/generate-bolts.py -P --page header $@ test_type < tools/test/test_cases > $@
|
||||
|
||||
tools/test/gen_print.c:
|
||||
echo '#include "gen_test.h"' > $@
|
||||
tools/generate-bolts.py -P --page impl ${@:.c=.h} test_type < tools/test/test_cases >> $@
|
||||
|
||||
|
||||
ALL_TEST_PROGRAMS += $(TOOL_TEST_PROGRAMS)
|
||||
|
||||
check-tools: $(TOOL_TEST_PROGRAMS:%=unittest/%)
|
||||
|
||||
update-mocks: tools-update-mocks
|
||||
|
||||
tools-update-mocks: $(TOOL_TEST_SRC:%=update-mocks/%)
|
||||
|
||||
clean: tools-test-clean
|
||||
|
||||
tools-test-clean:
|
||||
$(RM) $(TOOL_GEN_FILES) $(TOOL_TEST_OBJS)
|
||||
$(RM) $(TOOL_GEN_HEADER) $(TOOL_GEN_SRC) $(TOOL_TEST_OBJS)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "gen_test.h"
|
||||
#include "gen_print.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
@@ -6,6 +7,28 @@
|
||||
#include <common/utils.h>
|
||||
|
||||
/* AUTOGENERATED MOCKS START */
|
||||
/* Generated stub for fromwire_peektype */
|
||||
int fromwire_peektype(const u8 *cursor UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_peektype called!\n"); abort(); }
|
||||
/* Generated stub for printwire_amount_msat */
|
||||
void printwire_amount_msat(const char *fieldname UNNEEDED, const struct amount_msat *msat UNNEEDED)
|
||||
{ fprintf(stderr, "printwire_amount_msat called!\n"); abort(); }
|
||||
/* Generated stub for printwire_tlvs */
|
||||
void printwire_tlvs(const char *tlv_name UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED,
|
||||
const struct tlv_print_record_type types[] UNNEEDED, size_t num_types UNNEEDED)
|
||||
{ fprintf(stderr, "printwire_tlvs called!\n"); abort(); }
|
||||
/* Generated stub for printwire_u16 */
|
||||
void printwire_u16(const char *fieldname UNNEEDED, const u16 *v UNNEEDED)
|
||||
{ fprintf(stderr, "printwire_u16 called!\n"); abort(); }
|
||||
/* Generated stub for printwire_u32 */
|
||||
void printwire_u32(const char *fieldname UNNEEDED, const u32 *v UNNEEDED)
|
||||
{ fprintf(stderr, "printwire_u32 called!\n"); abort(); }
|
||||
/* Generated stub for printwire_u64 */
|
||||
void printwire_u64(const char *fieldname UNNEEDED, const u64 *v UNNEEDED)
|
||||
{ fprintf(stderr, "printwire_u64 called!\n"); abort(); }
|
||||
/* Generated stub for printwire_u8_array */
|
||||
void printwire_u8_array(const char *fieldname UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED, size_t len UNNEEDED)
|
||||
{ fprintf(stderr, "printwire_u8_array called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
int main(void)
|
||||
|
||||
Reference in New Issue
Block a user