diff --git a/tests/Makefile.tests b/tests/Makefile.tests index cc034bb..e97e903 100644 --- a/tests/Makefile.tests +++ b/tests/Makefile.tests @@ -43,10 +43,10 @@ tests_clean: rm -f $(STD_CLEANFILES:%=$(TESTS_PREFIX)%) rm -f $(TESTS_CLEANFILES) -check: tests +check: tests dtc cd $(TESTS_PREFIX); ./run_tests.sh -checkv: tests +checkv: tests dtc cd $(TESTS_PREFIX); ./run_tests.sh -v ifneq ($(DEPTARGETS),) diff --git a/tests/dtc.sh b/tests/dtc.sh new file mode 100755 index 0000000..f704f55 --- /dev/null +++ b/tests/dtc.sh @@ -0,0 +1,28 @@ +#! /bin/sh + +PASS () { + echo "PASS" + exit 0 +} + +FAIL () { + echo "FAIL" "$@" + exit 2 +} + +DTC=../dtc + +verbose_run () { + if [ -z "$QUIET_TEST" ]; then + "$@" + else + "$@" > /dev/null 2> /dev/null + fi +} + +if verbose_run "$DTC" "$@"; then + PASS +else + ret="$?" + FAIL "dtc returned error code $ret" +fi diff --git a/tests/run_tests.sh b/tests/run_tests.sh index 3973730..3c64e9d 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -86,6 +86,14 @@ libfdt_tests () { run_test truncated_property } +dtc_tests () { + # Make sure we don't have stale blobs lying around + rm -f *.test.dtb + + run_test dtc.sh -f -I dts -O dtb -o dtc_tree1.test.dtb test_tree1.dts + tree1_tests dtc_tree1.test.dtb +} + while getopts "vdt:" ARG ; do case $ARG in "v") @@ -98,7 +106,7 @@ while getopts "vdt:" ARG ; do done if [ -z "$TESTSETS" ]; then - TESTSETS="libfdt" + TESTSETS="libfdt dtc" fi for set in $TESTSETS; do @@ -106,6 +114,9 @@ for set in $TESTSETS; do "libfdt") libfdt_tests ;; + "dtc") + dtc_tests + ;; esac done diff --git a/tests/test_tree1.dts b/tests/test_tree1.dts new file mode 100644 index 0000000..5ddc208 --- /dev/null +++ b/tests/test_tree1.dts @@ -0,0 +1,20 @@ +/ { + prop-int = ; + prop-str = "hello world"; + + subnode1 { + prop-int = ; + + subsubnode { + prop-int = ; + }; + }; + + subnode2 { + prop-int = ; + + subsubnode { + prop-int = ; + }; + }; +};