From: David Gibson <david@gibson.dropbear.id.au>
To: Jon Loeliger <jdl@freescale.com>
Cc: linuxppc-dev@ozlabs.org
Subject: dtc: Testcases for input handling
Date: Wed, 5 Mar 2008 16:22:41 +1100 [thread overview]
Message-ID: <20080305052241.GL8399@localhost.localdomain> (raw)
This patch adds some testcases checking corner cases of dtc's input
file handling. Specifically it checks that dtc works correctly when
given input via stdin, and it checks that dtc fails gracefully if
given a nonexistent input file (or directory, in the case of -Ifs
mode).
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
tests/dtc-fatal.sh | 14 ++++++++++++++
tests/run_tests.sh | 11 +++++++++++
2 files changed, 25 insertions(+)
Index: dtc/tests/dtc-fatal.sh
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ dtc/tests/dtc-fatal.sh 2008-03-05 16:19:32.000000000 +1100
@@ -0,0 +1,14 @@
+#! /bin/sh
+
+. tests.sh
+
+verbose_run $VALGRIND "$DTC" -o/dev/null "$@"
+ret="$?"
+
+if [ "$ret" -gt 127 ]; then
+ FAIL "dtc killed by signal (ret=$ret)"
+elif [ "$ret" != "1" ]; then
+ FAIL "dtc returned incorrect status $ret instead of 1"
+fi
+
+PASS
Index: dtc/tests/run_tests.sh
===================================================================
--- dtc.orig/tests/run_tests.sh 2008-03-05 16:15:52.000000000 +1100
+++ dtc/tests/run_tests.sh 2008-03-05 16:16:15.000000000 +1100
@@ -239,6 +239,17 @@
run_sh_test dtc-checkfails.sh node_name_chars -- -I dtb -O dtb bad_node_char.dtb
run_sh_test dtc-checkfails.sh node_name_format -- -I dtb -O dtb bad_node_format.dtb
run_sh_test dtc-checkfails.sh prop_name_chars -- -I dtb -O dtb bad_prop_char.dtb
+
+ # Check for proper behaviour reading from stdin
+ run_dtc_test -I dts -O dtb -o stdin_dtc_tree1.test.dtb - < test_tree1.dts
+ run_wrap_test cmp stdin_dtc_tree1.test.dtb dtc_tree1.test.dtb
+ run_dtc_test -I dtb -O dts -o stdin_odts_test_tree1.dtb.test.dts - < test_tree1.dtb
+ run_wrap_test cmp stdin_odts_test_tree1.dtb.test.dts odts_test_tree1.dtb.test.dts
+
+ # Check for graceful failure in some error conditions
+ run_sh_test dtc-fatal.sh -I dts -O dtb nosuchfile.dts
+ run_sh_test dtc-fatal.sh -I dtb -O dtb nosuchfile.dtb
+ run_sh_test dtc-fatal.sh -I fs -O dtb nosuchfile
}
while getopts "vt:m" ARG ; do
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
reply other threads:[~2008-03-05 5:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080305052241.GL8399@localhost.localdomain \
--to=david@gibson.dropbear.id.au \
--cc=jdl@freescale.com \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).