This would catch the cases, where the output DTS still parses well and produces a tree that we expect, yet it contains some weirdness. Signed-off-by: Lubomir Rintel <lkundrak@xxxxx> --- tests/fs_tree1.dts | 43 +++++++++++++++++++++++++++++++++++++++++++ tests/run_tests.sh | 14 ++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 tests/fs_tree1.dts diff --git a/tests/fs_tree1.dts b/tests/fs_tree1.dts new file mode 100644 index 0000000..aeae436 --- /dev/null +++ b/tests/fs_tree1.dts @@ -0,0 +1,43 @@ +/dts-v1/; + +/ { + compatible = "test_tree1"; + #address-cells = <0x01>; + #size-cells = <0x00>; + prop-str = "hello world"; + prop-int = <0xdeadbeef>; + prop-int64 = <0xdeadbeef 0x1abcdef>; + + subnode@2 { + #address-cells = <0x01>; + linux,phandle = <0x2000>; + #size-cells = <0x00>; + reg = <0x02>; + prop-int = <0x75bcd15>; + + subsubnode@0 { + compatible = "subsubnode2\0subsubnode"; + phandle = <0x2001>; + reg = <0x00>; + prop-int = <0x75bcd15>; + }; + + ss2 { + }; + }; + + subnode@1 { + compatible = "subnode1"; + reg = <0x01>; + prop-int = <0xdeadbeef>; + + ss1 { + }; + + subsubnode { + compatible = "subsubnode1\0subsubnode"; + placeholder = "this is a placeholder string\0string2"; + prop-int = <0xdeadbeef>; + }; + }; +}; diff --git a/tests/run_tests.sh b/tests/run_tests.sh index bc2cc77..e6483b7 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -137,6 +137,19 @@ check_align () { ) } +# $1: first file +# $2: second file +files_equal () { + shorten_echo "files_equal $@: " + ( + if diff -q $1 $2; then + PASS + else + FAIL "File $1 differs from $2" + fi + ) +} + run_dtc_test () { printf "dtc $*: " base_run_test wrap_test $VALGRIND $DTC "$@" @@ -460,6 +473,7 @@ libfdt_tests () { run_dtc_test -I fs -O dts -o fs.test_tree1.test.dts $FSBASE/test_tree1 run_dtc_test -I fs -O dtb -o fs.test_tree1.test.dtb $FSBASE/test_tree1 run_test dtbs_equal_unordered -m fs.test_tree1.test.dtb test_tree1.dtb + base_run_test files_equal fs_tree1.dts fs.test_tree1.test.dts # check full tests for good in test_tree1.dtb; do -- 2.19.0