* [PATCH 1/3] Correct output from memreserve in fdtdump
@ 2014-06-18 7:00 Simon Glass
[not found] ` <1403074825-5069-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: Simon Glass @ 2014-06-18 7:00 UTC (permalink / raw)
To: Devicetree Compiler; +Cc: David Gibson, Jon Loeliger, Simon Glass
This currently displays a hex value without the 0x prefix. Add the prefix
as dtc requires it.
Signed-off-by: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
fdtdump.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fdtdump.c b/fdtdump.c
index 723770d..a29aa5e 100644
--- a/fdtdump.c
+++ b/fdtdump.c
@@ -88,7 +88,7 @@ static void dump_blob(void *blob, bool debug)
if (addr == 0 && size == 0)
break;
- printf("/memreserve/ %llx %llx;\n",
+ printf("/memreserve/ %#llx %#llx;\n",
(unsigned long long)addr, (unsigned long long)size);
}
--
2.0.0.526.g5318336
--
To unsubscribe from this list: send the line "unsubscribe devicetree-compiler" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] Tweak code to display cell values
[not found] ` <1403074825-5069-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
@ 2014-06-18 7:00 ` Simon Glass
[not found] ` <1403074825-5069-2-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2014-06-18 7:00 ` [PATCH 3/3] Add a basic test for fdtdump Simon Glass
2014-06-18 10:32 ` [PATCH 1/3] Correct output from memreserve in fdtdump David Gibson
2 siblings, 1 reply; 9+ messages in thread
From: Simon Glass @ 2014-06-18 7:00 UTC (permalink / raw)
To: Devicetree Compiler; +Cc: David Gibson, Jon Loeliger, Simon Glass
Move the division out of the loop; this seems slightly cleaner.
Signed-off-by: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
util.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/util.c b/util.c
index 1ce8b97..9d65226 100644
--- a/util.c
+++ b/util.c
@@ -371,9 +371,9 @@ void utilfdt_print_data(const char *data, int len)
const uint32_t *cell = (const uint32_t *)data;
printf(" = <");
- for (i = 0; i < len; i += 4)
- printf("0x%08x%s", fdt32_to_cpu(cell[i / 4]),
- i < (len - 4) ? " " : "");
+ for (i = 0, len /= 4; i < len; i++)
+ printf("0x%08x%s", fdt32_to_cpu(cell[i]),
+ i < (len - 1) ? " " : "");
printf(">");
} else {
printf(" = [");
--
2.0.0.526.g5318336
--
To unsubscribe from this list: send the line "unsubscribe devicetree-compiler" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] Add a basic test for fdtdump
[not found] ` <1403074825-5069-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2014-06-18 7:00 ` [PATCH 2/3] Tweak code to display cell values Simon Glass
@ 2014-06-18 7:00 ` Simon Glass
[not found] ` <1403074825-5069-3-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2014-06-18 10:32 ` [PATCH 1/3] Correct output from memreserve in fdtdump David Gibson
2 siblings, 1 reply; 9+ messages in thread
From: Simon Glass @ 2014-06-18 7:00 UTC (permalink / raw)
To: Devicetree Compiler; +Cc: David Gibson, Jon Loeliger, Simon Glass
We can test fdtdump by comparing its output with the source file that was
compiled by dtc. Add a simple test that should at least catch regressions
in basic functionality.
Signed-off-by: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
tests/fdtdump-runtest.sh | 30 ++++++++++++++++++++++++++++++
tests/fdtdump.dts | 37 +++++++++++++++++++++++++++++++++++++
tests/run_tests.sh | 29 +++++++++++++++++++++++++++++
tests/tests.sh | 1 +
4 files changed, 97 insertions(+)
create mode 100644 tests/fdtdump-runtest.sh
create mode 100644 tests/fdtdump.dts
diff --git a/tests/fdtdump-runtest.sh b/tests/fdtdump-runtest.sh
new file mode 100644
index 0000000..a0796da
--- /dev/null
+++ b/tests/fdtdump-runtest.sh
@@ -0,0 +1,30 @@
+#! /bin/sh
+
+# Arguments:
+# $1 - source file to compile and compare with fdtdump output of the
+# compiled file.
+
+. ./tests.sh
+
+dts="$1"
+dtb="${dts}.dtb"
+out="${dts}.out"
+LOG=tmp.log.$$
+
+files="$dtb $out $LOG"
+
+rm -f $files
+trap "rm -f $files" 0
+
+verbose_run_log_check "$LOG" $VALGRIND $DTC -O dtb $dts -o $dtb
+$FDTDUMP ${dtb} | grep -v "//" >${out}
+
+if diff -w $dts $out >/dev/null; then
+ PASS
+else
+ if [ -z "$QUIET_TEST" ]; then
+ echo "DIFF :-:"
+ diff -w $dts $out
+ fi
+ FAIL "Results differ from expected"
+fi
diff --git a/tests/fdtdump.dts b/tests/fdtdump.dts
new file mode 100644
index 0000000..b9d917b
--- /dev/null
+++ b/tests/fdtdump.dts
@@ -0,0 +1,37 @@
+/dts-v1/;
+
+/memreserve/ 0 0xe;
+/ {
+ model = "MyBoardName";
+ compatible = "MyBoardName", "MyBoardFamilyName";
+ #address-cells = <0x00000002>;
+ #size-cells = <0x00000002>;
+ cpus {
+ linux,phandle = <0x00000001>;
+ #address-cells = <0x00000001>;
+ #size-cells = <0x00000000>;
+ PowerPC,970@0 {
+ device_type = "cpu";
+ reg = <0x00000000>;
+ linux,boot-cpu;
+ };
+ PowerPC,970@1 {
+ device_type = "cpu";
+ reg = <0x00000001>;
+ };
+ };
+ randomnode {
+ string = "foo", "stuff";
+ bytes = [61 62 63 64 65];
+ child {
+ };
+ };
+ memory@0 {
+ device_type = "memory";
+ reg = <0x00000000 0x00000123 0x00000456 0x87654321>;
+ };
+ chosen {
+ bootargs = "root=/dev/sda2";
+ linux,platform = <0x00000600>;
+ };
+};
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index f205ce6..8273abf 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -138,6 +138,13 @@ run_fdtput_test () {
base_run_test sh fdtput-runtest.sh "$expect" "$@"
}
+run_fdtdump_test() {
+ file="$1"
+ shorten_echo fdtdump-runtest.sh "$file"
+ echo -n ": "
+ base_run_test sh fdtdump-runtest.sh "$file"
+}
+
tree1_tests () {
TREE=$1
@@ -602,6 +609,25 @@ utilfdt_tests () {
run_test utilfdt_test
}
+fdtdump_tests () {
+ run_fdtdump_test fdtdump.dts
+ return
+
+ local dts=fdtdump.dts
+ local dtb=fdtdump.dts.dtb
+ local out=fdtdump.dts.out
+ run_dtc_test -O dtb $dts -o ${dtb}
+ $FDTDUMP ${dtb} | grep -v "//" >${out}
+ if cmp $dts $out >/dev/null; then
+ PASS
+ else
+ if [ -z "$QUIET_TEST" ]; then
+ diff -w fdtdump.dts $out
+ fi
+ FAIL "Results differ from expected"
+ fi
+}
+
while getopts "vt:me" ARG ; do
case $ARG in
"v")
@@ -646,6 +672,9 @@ for set in $TESTSETS; do
"fdtput")
fdtput_tests
;;
+ "fdtdump")
+ fdtdump_tests
+ ;;
esac
done
diff --git a/tests/tests.sh b/tests/tests.sh
index 31530d5..818fd09 100644
--- a/tests/tests.sh
+++ b/tests/tests.sh
@@ -21,6 +21,7 @@ FAIL_IF_SIGNAL () {
DTC=../dtc
DTGET=../fdtget
DTPUT=../fdtput
+FDTDUMP=../fdtdump
verbose_run () {
if [ -z "$QUIET_TEST" ]; then
--
2.0.0.526.g5318336
--
To unsubscribe from this list: send the line "unsubscribe devicetree-compiler" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] Correct output from memreserve in fdtdump
[not found] ` <1403074825-5069-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2014-06-18 7:00 ` [PATCH 2/3] Tweak code to display cell values Simon Glass
2014-06-18 7:00 ` [PATCH 3/3] Add a basic test for fdtdump Simon Glass
@ 2014-06-18 10:32 ` David Gibson
[not found] ` <20140618103215.GF29264-1s0os16eZneny3qCrzbmXA@public.gmane.org>
2 siblings, 1 reply; 9+ messages in thread
From: David Gibson @ 2014-06-18 10:32 UTC (permalink / raw)
To: Simon Glass; +Cc: Devicetree Compiler, Jon Loeliger
[-- Attachment #1: Type: text/plain, Size: 977 bytes --]
On Wed, Jun 18, 2014 at 01:00:22AM -0600, Simon Glass wrote:
> This currently displays a hex value without the 0x prefix. Add the prefix
> as dtc requires it.
>
> Signed-off-by: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> ---
> fdtdump.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fdtdump.c b/fdtdump.c
> index 723770d..a29aa5e 100644
> --- a/fdtdump.c
> +++ b/fdtdump.c
> @@ -88,7 +88,7 @@ static void dump_blob(void *blob, bool debug)
> if (addr == 0 && size == 0)
> break;
>
> - printf("/memreserve/ %llx %llx;\n",
> + printf("/memreserve/ %#llx %#llx;\n",
Is the # modifier and its behaviour standardized? I couldn't quickly
find a reference.
Might be safer to do it as an explicit 0x%llx.
--
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
[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] Correct output from memreserve in fdtdump
[not found] ` <20140618103215.GF29264-1s0os16eZneny3qCrzbmXA@public.gmane.org>
@ 2014-06-18 11:14 ` David Gibson
[not found] ` <20140618111429.GG29264-1s0os16eZneny3qCrzbmXA@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: David Gibson @ 2014-06-18 11:14 UTC (permalink / raw)
To: Simon Glass; +Cc: Devicetree Compiler, Jon Loeliger
[-- Attachment #1: Type: text/plain, Size: 1119 bytes --]
On Wed, Jun 18, 2014 at 08:32:15PM +1000, David Gibson wrote:
> On Wed, Jun 18, 2014 at 01:00:22AM -0600, Simon Glass wrote:
> > This currently displays a hex value without the 0x prefix. Add the prefix
> > as dtc requires it.
> >
> > Signed-off-by: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> > ---
> > fdtdump.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fdtdump.c b/fdtdump.c
> > index 723770d..a29aa5e 100644
> > --- a/fdtdump.c
> > +++ b/fdtdump.c
> > @@ -88,7 +88,7 @@ static void dump_blob(void *blob, bool debug)
> > if (addr == 0 && size == 0)
> > break;
> >
> > - printf("/memreserve/ %llx %llx;\n",
> > + printf("/memreserve/ %#llx %#llx;\n",
>
> Is the # modifier and its behaviour standardized? I couldn't quickly
> find a reference.
Never mind, found the reference, and the # flag's behaviour is there.
Applied.
--
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
[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] Tweak code to display cell values
[not found] ` <1403074825-5069-2-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
@ 2014-06-18 11:15 ` David Gibson
0 siblings, 0 replies; 9+ messages in thread
From: David Gibson @ 2014-06-18 11:15 UTC (permalink / raw)
To: Simon Glass; +Cc: Devicetree Compiler, Jon Loeliger
[-- Attachment #1: Type: text/plain, Size: 337 bytes --]
On Wed, Jun 18, 2014 at 01:00:23AM -0600, Simon Glass wrote:
> Move the division out of the loop; this seems slightly cleaner.
Applied.
--
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
[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] Add a basic test for fdtdump
[not found] ` <1403074825-5069-3-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
@ 2014-06-18 11:26 ` David Gibson
0 siblings, 0 replies; 9+ messages in thread
From: David Gibson @ 2014-06-18 11:26 UTC (permalink / raw)
To: Simon Glass; +Cc: Devicetree Compiler, Jon Loeliger
[-- Attachment #1: Type: text/plain, Size: 738 bytes --]
On Wed, Jun 18, 2014 at 01:00:24AM -0600, Simon Glass wrote:
> We can test fdtdump by comparing its output with the source file that was
> compiled by dtc. Add a simple test that should at least catch regressions
> in basic functionality.
Never really bothered, since fdtdump is basically a hack tool.
Applied with a few changes:
* Added fdtdump to TESTS_BIN, so it gets made for a "make check"
* Added the fdtdump test to the default set of tests run by
run_tests.sh
* Changed to a unified diff in fdtdump-runtest.sh
--
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
[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] Correct output from memreserve in fdtdump
[not found] ` <20140618111429.GG29264-1s0os16eZneny3qCrzbmXA@public.gmane.org>
@ 2014-06-18 14:24 ` Jon Loeliger
[not found] ` <E1WxGmt-0004MW-Vk-CYoMK+44s/E@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: Jon Loeliger @ 2014-06-18 14:24 UTC (permalink / raw)
To: David Gibson; +Cc: Simon Glass, Devicetree Compiler
>
>
> Never mind, found the reference, and the # flag's behaviour is there.
>
> Applied.
Geeze. You guys generated patches, discussed, and
applied them before I even woke up and read them! :-)
jdl
--
To unsubscribe from this list: send the line "unsubscribe devicetree-compiler" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] Correct output from memreserve in fdtdump
[not found] ` <E1WxGmt-0004MW-Vk-CYoMK+44s/E@public.gmane.org>
@ 2014-06-23 12:21 ` Simon Glass
0 siblings, 0 replies; 9+ messages in thread
From: Simon Glass @ 2014-06-23 12:21 UTC (permalink / raw)
To: Jon Loeliger; +Cc: David Gibson, Devicetree Compiler
Hi Jon,
On 18 June 2014 08:24, Jon Loeliger <jdl-CYoMK+44s/E@public.gmane.org> wrote:
>>
>>
>> Never mind, found the reference, and the # flag's behaviour is there.
>>
>> Applied.
>
> Geeze. You guys generated patches, discussed, and
> applied them before I even woke up and read them! :-)
Yes that was a bit quicker than my last series!
Regards,
Simon
--
To unsubscribe from this list: send the line "unsubscribe devicetree-compiler" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-06-23 12:21 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-18 7:00 [PATCH 1/3] Correct output from memreserve in fdtdump Simon Glass
[not found] ` <1403074825-5069-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2014-06-18 7:00 ` [PATCH 2/3] Tweak code to display cell values Simon Glass
[not found] ` <1403074825-5069-2-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2014-06-18 11:15 ` David Gibson
2014-06-18 7:00 ` [PATCH 3/3] Add a basic test for fdtdump Simon Glass
[not found] ` <1403074825-5069-3-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2014-06-18 11:26 ` David Gibson
2014-06-18 10:32 ` [PATCH 1/3] Correct output from memreserve in fdtdump David Gibson
[not found] ` <20140618103215.GF29264-1s0os16eZneny3qCrzbmXA@public.gmane.org>
2014-06-18 11:14 ` David Gibson
[not found] ` <20140618111429.GG29264-1s0os16eZneny3qCrzbmXA@public.gmane.org>
2014-06-18 14:24 ` Jon Loeliger
[not found] ` <E1WxGmt-0004MW-Vk-CYoMK+44s/E@public.gmane.org>
2014-06-23 12:21 ` Simon Glass
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.