1LIB_TESTS_L = get_mem_rsv \
2	root_node find_property subnode_offset path_offset \
3	get_name getprop get_prop_offset get_phandle \
4	get_path supernode_atdepth_offset parent_offset \
5	node_offset_by_prop_value node_offset_by_phandle \
6	node_check_compatible node_offset_by_compatible \
7	get_alias \
8	char_literal \
9	sized_cells \
10	notfound \
11	addr_size_cells \
12	addr_size_cells2 \
13	appendprop_addrrange \
14	stringlist \
15	setprop_inplace nop_property nop_node \
16	sw_tree1 sw_states \
17	move_and_save mangle-layout nopulate \
18	open_pack rw_tree1 rw_oom set_name setprop del_property del_node \
19	appendprop1 appendprop2 propname_escapes \
20	string_escapes references path-references phandle_format \
21	boot-cpuid incbin \
22	extra-terminating-null \
23	dtbs_equal_ordered \
24	dtb_reverse dtbs_equal_unordered \
25	add_subnode_with_nops path_offset_aliases \
26	utilfdt_test \
27	integer-expressions \
28	property_iterate \
29	subnode_iterate \
30	overlay overlay_bad_fixup \
31	check_path check_header check_full \
32	fs_tree1
33LIB_TESTS = $(LIB_TESTS_L:%=$(TESTS_PREFIX)%)
34
35LIBTREE_TESTS_L = truncated_property truncated_string truncated_memrsv
36LIBTREE_TESTS = $(LIBTREE_TESTS_L:%=$(TESTS_PREFIX)%)
37
38DL_LIB_TESTS_L = asm_tree_dump value-labels
39DL_LIB_TESTS = $(DL_LIB_TESTS_L:%=$(TESTS_PREFIX)%)
40
41TESTS = $(LIB_TESTS) $(LIBTREE_TESTS) $(DL_LIB_TESTS)
42
43TESTS_TREES_L = test_tree1.dtb
44TESTS_TREES = $(TESTS_TREES_L:%=$(TESTS_PREFIX)%)
45
46TESTS_TARGETS = $(TESTS) $(TESTS_TREES)
47
48TESTS_DEPFILES = $(TESTS:%=%.d) \
49	$(addprefix $(TESTS_PREFIX),testutils.d trees.d dumptrees.d)
50
51TESTS_CLEANFILES_L = $(STD_CLEANFILES) \
52	*.dtb *.test.dts *.test.dt.yaml *.dtsv1 tmp.* *.bak \
53	dumptrees
54TESTS_CLEANFILES = $(TESTS) $(TESTS_CLEANFILES_L:%=$(TESTS_PREFIX)%)
55TESTS_CLEANDIRS_L = fs
56TESTS_CLEANDIRS = $(TESTS_CLEANDIRS_L:%=$(TESTS_PREFIX)%)
57
58.PHONY: tests
59tests:	$(TESTS) $(TESTS_TREES)
60
61$(LIB_TESTS): %: $(TESTS_PREFIX)testutils.o util.o $(LIBFDT_lib)
62
63# Not necessary on all platforms; allow -ldl to be excluded instead of forcing
64# other platforms to patch it out.
65LIBDL = -ldl
66$(DL_LIB_TESTS): %: %.o $(TESTS_PREFIX)testutils.o util.o $(LIBFDT_lib)
67	@$(VECHO) LD [libdl] $@
68	$(LINK.c) -o $@ $^ $(LIBDL)
69
70$(LIBTREE_TESTS): %: $(TESTS_PREFIX)testutils.o $(TESTS_PREFIX)trees.o \
71		util.o $(LIBFDT_lib)
72
73$(TESTS_PREFIX)dumptrees: $(TESTS_PREFIX)trees.o
74
75$(TESTS_TREES): $(TESTS_PREFIX)dumptrees
76	@$(VECHO) DUMPTREES
77	cd $(TESTS_PREFIX); ./dumptrees . >/dev/null
78
79tests_clean:
80	@$(VECHO) CLEAN "(tests)"
81	rm -f $(TESTS_CLEANFILES)
82	rm -rf $(TESTS_CLEANDIRS)
83
84check:	tests ${TESTS_BIN} $(TESTS_PYLIBFDT)
85	cd $(TESTS_PREFIX); ./run_tests.sh
86
87ifeq ($(NO_VALGRIND),1)
88checkm:
89	@echo "make checkm requires valgrind, but NO_VALGRIND=1"
90else
91checkm: tests ${TESTS_BIN} $(TESTS_PYLIBFDT)
92	cd $(TESTS_PREFIX); ./run_tests.sh -m
93endif
94
95checkv:	tests ${TESTS_BIN} $(TESTS_PYLIBFDT)
96	cd $(TESTS_PREFIX); ./run_tests.sh -v
97
98ifneq ($(DEPTARGETS),)
99-include $(TESTS_DEPFILES)
100endif
101