* dtc: Add basic testcases for dtc
@ 2007-09-18 0:33 David Gibson
2007-09-18 15:02 ` Jon Loeliger
0 siblings, 1 reply; 3+ messages in thread
From: David Gibson @ 2007-09-18 0:33 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev
This patch adds a handful of simple testcases for dtc. It adds a dts
file which should generate the same sample tree as is used for the
libfdt testcases, and tests invoking dtc on this dts, plus the
standard batch of libfdt cases on the resulting dtb, which effectively
checks that the dtb is correct.
Because the test framework assumes each testcase is an executable with
the right output conventions, we use a little shell script, dtc.sh, as
a wrapper around dtc itself. It simply invokes dtc and returns a PASS
or FAIL depending on whether dtc returned an error.
It's not much, but it's a start.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
NB: Jon, you won't be able to simply git-applymbox this and have it
work. You'll need to manually add execute permission to tests/dtc.sh
before git commiting it, since I can't encode the permissions in a
patch. Sorry for the inconvenience, but it didn't really seem worth
setting up my own git to pull from just for that.
Index: dtc/tests/run_tests.sh
===================================================================
--- dtc.orig/tests/run_tests.sh 2007-09-18 10:06:28.000000000 +1000
+++ dtc/tests/run_tests.sh 2007-09-18 10:06:31.000000000 +1000
@@ -86,6 +86,14 @@
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 @@
done
if [ -z "$TESTSETS" ]; then
- TESTSETS="libfdt"
+ TESTSETS="libfdt dtc"
fi
for set in $TESTSETS; do
@@ -106,6 +114,9 @@
"libfdt")
libfdt_tests
;;
+ "dtc")
+ dtc_tests
+ ;;
esac
done
Index: dtc/tests/test_tree1.dts
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ dtc/tests/test_tree1.dts 2007-09-18 10:06:31.000000000 +1000
@@ -0,0 +1,20 @@
+/ {
+ prop-int = <deadbeef>;
+ prop-str = "hello world";
+
+ subnode1 {
+ prop-int = <deadbeef>;
+
+ subsubnode {
+ prop-int = <deadbeef>;
+ };
+ };
+
+ subnode2 {
+ prop-int = <abcd1234>;
+
+ subsubnode {
+ prop-int = <abcd1234>;
+ };
+ };
+};
Index: dtc/tests/dtc.sh
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ dtc/tests/dtc.sh 2007-09-18 10:07:34.000000000 +1000
@@ -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
Index: dtc/tests/Makefile.tests
===================================================================
--- dtc.orig/tests/Makefile.tests 2007-09-18 10:27:30.000000000 +1000
+++ dtc/tests/Makefile.tests 2007-09-18 10:27:46.000000000 +1000
@@ -43,10 +43,10 @@
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),)
--
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: dtc: Add basic testcases for dtc
2007-09-18 0:33 dtc: Add basic testcases for dtc David Gibson
@ 2007-09-18 15:02 ` Jon Loeliger
2007-09-19 2:48 ` David Gibson
0 siblings, 1 reply; 3+ messages in thread
From: Jon Loeliger @ 2007-09-18 15:02 UTC (permalink / raw)
To: David Gibson; +Cc: linuxppc-dev
So, like, the other day David Gibson mumbled:
> This patch adds a handful of simple testcases for dtc. It adds a dts
> file which should generate the same sample tree as is used for the
> libfdt testcases, and tests invoking dtc on this dts, plus the
> standard batch of libfdt cases on the resulting dtb, which effectively
> checks that the dtb is correct.
>
> Because the test framework assumes each testcase is an executable with
> the right output conventions, we use a little shell script, dtc.sh, as
> a wrapper around dtc itself. It simply invokes dtc and returns a PASS
> or FAIL depending on whether dtc returned an error.
>
> It's not much, but it's a start.
>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Applied.
> NB: Jon, you won't be able to simply git-applymbox this and have it
> work. You'll need to manually add execute permission to tests/dtc.sh
> before git commiting it, since I can't encode the permissions in a
> patch. Sorry for the inconvenience, but it didn't really seem worth
> setting up my own git to pull from just for that.
No problem. Too bad you can't just use git, though... :-)
jdl
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: dtc: Add basic testcases for dtc
2007-09-18 15:02 ` Jon Loeliger
@ 2007-09-19 2:48 ` David Gibson
0 siblings, 0 replies; 3+ messages in thread
From: David Gibson @ 2007-09-19 2:48 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev
On Tue, Sep 18, 2007 at 10:02:37AM -0500, Jon Loeliger wrote:
> So, like, the other day David Gibson mumbled:
> > This patch adds a handful of simple testcases for dtc. It adds a dts
> > file which should generate the same sample tree as is used for the
> > libfdt testcases, and tests invoking dtc on this dts, plus the
> > standard batch of libfdt cases on the resulting dtb, which effectively
> > checks that the dtb is correct.
> >
> > Because the test framework assumes each testcase is an executable with
> > the right output conventions, we use a little shell script, dtc.sh, as
> > a wrapper around dtc itself. It simply invokes dtc and returns a PASS
> > or FAIL depending on whether dtc returned an error.
> >
> > It's not much, but it's a start.
> >
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
>
>
> Applied.
>
> > NB: Jon, you won't be able to simply git-applymbox this and have it
> > work. You'll need to manually add execute permission to tests/dtc.sh
> > before git commiting it, since I can't encode the permissions in a
> > patch. Sorry for the inconvenience, but it didn't really seem worth
> > setting up my own git to pull from just for that.
>
> No problem. Too bad you can't just use git, though... :-)
Hrm. Perhaps I should. I've been working with patches, because it
matches how I operate with the kernel, but I guess there would be some
advantages to running my own dtc git branch.
--
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-09-19 2:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-18 0:33 dtc: Add basic testcases for dtc David Gibson
2007-09-18 15:02 ` Jon Loeliger
2007-09-19 2:48 ` David Gibson
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).