[Crosstoolchain-logs] [device-tree-compiler] 216/357: dtc: More detailed testing of tree checks
Hector Oron
zumbi at moszumanska.debian.org
Thu Dec 8 17:06:15 UTC 2016
This is an automated email from the git hooks/post-receive script.
zumbi pushed a commit to branch upstream/1.3.x
in repository device-tree-compiler.
commit 5ba0086bfd0fa6ab25f7ce1870417301a26c104f
Author: David Gibson <david at gibson.dropbear.id.au>
Date: Thu Dec 6 16:56:55 2007 +1100
dtc: More detailed testing of tree checks
This patch modifies the dtc-checkfails.sh testcase wrapper so that
instead of testing just that dtc fails with a particular error code on
the sample input, it scans dtc's stderr output looking for a message
that dtc failed a specific check or checks. This has several advantages:
- It means we more precisely check dtc's checking behaviour
- It means we can check for generation of warnings using the
same script
- It means we can test cases where dtc should generate
multiple errors or warnings from different checks
Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
---
tests/Makefile.tests | 2 +-
tests/dtc-checkfails.sh | 30 ++++++++++++++++++------------
tests/run_tests.sh | 16 ++++++++--------
tests/tests.sh | 11 +++++++++++
4 files changed, 38 insertions(+), 21 deletions(-)
diff --git a/tests/Makefile.tests b/tests/Makefile.tests
index ff87eaa..8d17b89 100644
--- a/tests/Makefile.tests
+++ b/tests/Makefile.tests
@@ -26,7 +26,7 @@ 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
+TESTS_CLEANFILES_L = *.output vglog.* vgcore.* *.dtb *.test.dts tmp.*
TESTS_CLEANFILES = $(TESTS_CLEANFILES_L:%=$(TESTS_PREFIX)%)
BIN += $(TESTS) $(TESTS_PREFIX)dumptrees
diff --git a/tests/dtc-checkfails.sh b/tests/dtc-checkfails.sh
index 0a45a0b..cca4119 100755
--- a/tests/dtc-checkfails.sh
+++ b/tests/dtc-checkfails.sh
@@ -2,21 +2,27 @@
. tests.sh
-TMPFILE="tmp.out.$$"
+for x; do
+ shift
+ if [ "$x" = "--" ]; then
+ break;
+ fi
+ CHECKS="$CHECKS $x"
+done
-rm -f $TMPFILE
+LOG="tmp.log.$$"
-verbose_run "$DTC" -o $TMPFILE "$@"
+rm -f $TMPFILE $LOG
+
+verbose_run_log "$LOG" "$DTC" -o /dev/null "$@"
ret="$?"
-if [ -f $TMPFILE ]; then
- FAIL "output file was created despite bad input"
-fi
+for c in $CHECKS; do
+ if ! grep -E "^(ERROR)|(Warning) \($c\):" $LOG > /dev/null; then
+ FAIL "Failed to trigger check \"%c\""
+ fi
+done
-if [ "$ret" = "2" ]; then
- PASS
-else
- FAIL "dtc returned error code $ret instead of 2 (check failed)"
-fi
+rm -f $LOG
-rm -f $TMPFILE
+PASS
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 4a70b4a..e044bd2 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -158,14 +158,14 @@ dtc_tests () {
done
# Check some checks
- run_test dtc-checkfails.sh -I dts -O dtb dup-nodename.dts
- run_test dtc-checkfails.sh -I dts -O dtb dup-propname.dts
- run_test dtc-checkfails.sh -I dts -O dtb dup-phandle.dts
- run_test dtc-checkfails.sh -I dts -O dtb zero-phandle.dts
- run_test dtc-checkfails.sh -I dts -O dtb minusone-phandle.dts
- run_test dtc-checkfails.sh -I dts -O dtb nonexist-node-ref.dts
- run_test dtc-checkfails.sh -I dts -O dtb nonexist-label-ref.dts
- run_test dtc-checkfails.sh -I dts -O dtb bad-name-property.dts
+ run_test dtc-checkfails.sh duplicate_node_names -- -I dts -O dtb dup-nodename.dts
+ run_test dtc-checkfails.sh duplicate_property_names -- -I dts -O dtb dup-propname.dts
+ run_test dtc-checkfails.sh explicit_phandles -- -I dts -O dtb dup-phandle.dts
+ run_test dtc-checkfails.sh explicit_phandles -- -I dts -O dtb zero-phandle.dts
+ run_test dtc-checkfails.sh explicit_phandles -- -I dts -O dtb minusone-phandle.dts
+ run_test dtc-checkfails.sh phandle_references -- -I dts -O dtb nonexist-node-ref.dts
+ run_test dtc-checkfails.sh phandle_references -- -I dts -O dtb nonexist-label-ref.dts
+ run_test dtc-checkfails.sh name_properties -- -I dts -O dtb bad-name-property.dts
}
while getopts "vt:m" ARG ; do
diff --git a/tests/tests.sh b/tests/tests.sh
index 396b4cf..28b3fb1 100644
--- a/tests/tests.sh
+++ b/tests/tests.sh
@@ -19,3 +19,14 @@ verbose_run () {
"$@" > /dev/null 2> /dev/null
fi
}
+
+verbose_run_log () {
+ LOG="$1"
+ shift
+ "$@" &> "$LOG"
+ ret=$?
+ if [ -z "$QUIET_TEST" ]; then
+ cat "$LOG" >&2
+ fi
+ return $ret
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/crosstoolchain/device-tree-compiler.git
More information about the Crosstoolchain-logs
mailing list