mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 16:27:39 -04:00
This patch adds some testcases for dtc's -Oasm mode. Specifically it checks that building the asm will result in the same device tree blob in memory as -Odtb mode would produce, for a variety of trees. This test uncovered two difficulties with our current -Oasm output, both of which are addressed in this patch as well. First, -Oasm output would only be correct if assembled for a big-endian target. Usually that would be the case, when building device trees into a firmware or similar. However this makes life inconvenient for testing on a little-endian target, and one can think up use cases where a program running on a little endian host might want to embed a device tree for a big-endian target. This patch therefore changes -Oasm output to use .byte directives instead of .long throughout in order to generate byte-for-byte identical trees regardless of the endianness of the assembler target. Second, -Oasm output emitted several #define statements which were then used in the innards of the output - i.e. it assumed the output would be processed by cpp before being assembled. That may not be convenient in all build environments, and in any case doesn't work well with the above fix. So, -Oasm output no longer needs to be preprocessed before assembling. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
70 lines
2 KiB
Text
70 lines
2 KiB
Text
LIB_TESTS_L = get_mem_rsv \
|
|
root_node find_property subnode_offset path_offset \
|
|
get_name getprop get_phandle \
|
|
get_path supernode_atdepth_offset parent_offset \
|
|
node_offset_by_prop_value node_offset_by_phandle \
|
|
node_check_compatible node_offset_by_compatible \
|
|
get_alias \
|
|
notfound \
|
|
setprop_inplace nop_property nop_node \
|
|
sw_tree1 \
|
|
move_and_save mangle-layout nopulate \
|
|
open_pack rw_tree1 set_name setprop del_property del_node \
|
|
string_escapes references path-references boot-cpuid incbin \
|
|
dtbs_equal_ordered \
|
|
add_subnode_with_nops path_offset_aliases
|
|
LIB_TESTS = $(LIB_TESTS_L:%=$(TESTS_PREFIX)%)
|
|
|
|
LIBTREE_TESTS_L = truncated_property
|
|
LIBTREE_TESTS = $(LIBTREE_TESTS_L:%=$(TESTS_PREFIX)%)
|
|
|
|
DL_LIB_TESTS_L = asm_tree_dump
|
|
DL_LIB_TESTS = $(DL_LIB_TESTS_L:%=$(TESTS_PREFIX)%)
|
|
|
|
TESTS = $(LIB_TESTS) $(LIBTREE_TESTS) $(DL_LIB_TESTS)
|
|
|
|
TESTS_TREES_L = test_tree1.dtb
|
|
TESTS_TREES = $(TESTS_TREES_L:%=$(TESTS_PREFIX)%)
|
|
|
|
TESTS_TARGETS = $(TESTS) $(TESTS_TREES)
|
|
|
|
TESTS_DEPFILES = $(TESTS:%=%.d) \
|
|
$(addprefix $(TESTS_PREFIX),testutils.d trees.d dumptrees.d)
|
|
|
|
TESTS_CLEANFILES_L = *.output vglog.* vgcore.* *.dtb *.test.dts *.dtsv1 tmp.*
|
|
TESTS_CLEANFILES_L += dumptrees
|
|
TESTS_CLEANFILES = $(TESTS) $(TESTS_CLEANFILES_L:%=$(TESTS_PREFIX)%)
|
|
|
|
.PHONY: tests
|
|
tests: $(TESTS) $(TESTS_TREES)
|
|
|
|
$(LIB_TESTS): %: $(TESTS_PREFIX)testutils.o $(LIBFDT_archive)
|
|
|
|
$(DL_LIB_TESTS): %: $(TESTS_PREFIX)testutils.o $(LIBFDT_archive) -ldl
|
|
|
|
$(LIBTREE_TESTS): %: $(TESTS_PREFIX)testutils.o $(TESTS_PREFIX)trees.o $(LIBFDT_archive)
|
|
|
|
$(TESTS_PREFIX)dumptrees: $(TESTS_PREFIX)trees.o
|
|
|
|
$(TESTS_TREES): $(TESTS_PREFIX)dumptrees
|
|
@$(VECHO) DUMPTREES
|
|
cd $(TESTS_PREFIX); ./dumptrees >/dev/null
|
|
|
|
tests_clean:
|
|
@$(VECHO) CLEAN "(tests)"
|
|
rm -f $(STD_CLEANFILES:%=$(TESTS_PREFIX)%)
|
|
rm -f $(TESTS_CLEANFILES)
|
|
|
|
check: tests dtc convert-dtsv0
|
|
cd $(TESTS_PREFIX); ./run_tests.sh
|
|
|
|
checkm: tests dtc convert-dtsv0
|
|
cd $(TESTS_PREFIX); ./run_tests.sh -m 2>&1 | tee vglog.$$$$
|
|
|
|
checkv: tests dtc convert-dtsv0
|
|
cd $(TESTS_PREFIX); ./run_tests.sh -v
|
|
|
|
ifneq ($(DEPTARGETS),)
|
|
-include $(TESTS_DEPFILES)
|
|
endif
|
|
|