* [PATCH 2/2] Properly handle nul delimited string lists
@ 2014-06-24 18:31 Jack Miller
0 siblings, 0 replies; 5+ messages in thread
From: Jack Miller @ 2014-06-24 18:31 UTC (permalink / raw)
To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
reserved-names="res1\0res2\0res3";
Where \0 is a true embedded nul in the DTS source, should properly turn
into a string list. To achieve this, use the len given by the lexer
instead of strlen.
Without this patch dtc will mangle the output and possible hang on
realloc.
---
data.c | 2 +-
tests/nul_string_list.dtb | Bin 0 -> 127 bytes
tests/nul_string_list.dts | Bin 0 -> 66 bytes
tests/run_tests.sh | 3 +++
4 files changed, 4 insertions(+), 1 deletion(-)
create mode 100644 tests/nul_string_list.dtb
create mode 100644 tests/nul_string_list.dts
diff --git a/data.c b/data.c
index 4c50b12..8cae237 100644
--- a/data.c
+++ b/data.c
@@ -74,7 +74,7 @@ struct data data_copy_escape_string(const char *s, int len)
struct data d;
char *q;
- d = data_grow_for(empty_data, strlen(s)+1);
+ d = data_grow_for(empty_data, len + 1);
q = d.val;
while (i < len) {
diff --git a/tests/nul_string_list.dtb b/tests/nul_string_list.dtb
new file mode 100644
index 0000000000000000000000000000000000000000..ea2bc3915d8129c849d2cc7b247bc9d1a201256c
GIT binary patch
literal 127
zcmcb>`|m9S14BI!TL5tZ5NiOjAP@@xF$nMjF-Q&_FhT{GfwVM;U6fj!T2z*52xAz*
W7{*|gOhA$oswPD@FEKZ@m;nI8VH4E=
literal 0
HcmV?d00001
diff --git a/tests/nul_string_list.dts b/tests/nul_string_list.dts
new file mode 100644
index 0000000000000000000000000000000000000000..845a14425fd36db3fac2934d1412dbb2cd8fb3a9
GIT binary patch
literal 66
zcmdN-DJj-1Gt{@{;?h^B=He_$Elw>eOHI+uOUz9zR<Ko2f{GY2Kp93bhOv@0SFJS{
E0H@#-od5s;
literal 0
HcmV?d00001
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index f94d361..94b462a 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -321,6 +321,9 @@ dtc_tests () {
run_dtc_test -I dts -O dtb -o dtc_comments-cmp.test.dtb comments-cmp.dts
run_test dtbs_equal_ordered dtc_comments.test.dtb dtc_comments-cmp.test.dtb
+ run_dtc_test -I dts -O dtb -o dtc_nul_string_list.test.dtb nul_string_list.dts
+ run_test dtbs_equal_ordered dtc_nul_string_list.test.dtb nul_string_list.dtb
+
# Check aliases support in fdt_path_offset
run_dtc_test -I dts -O dtb -o aliases.dtb aliases.dts
run_test get_alias aliases.dtb
--
2.0.0
--
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] 5+ messages in thread
* [PATCH] Nul delimiter redux
@ 2014-06-24 19:50 Jack Miller
[not found] ` <1403639439-1032-1-git-send-email-jack-jZyo8ZIaZD9AfugRpC6u6w@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Jack Miller @ 2014-06-24 19:50 UTC (permalink / raw)
To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
I missent the last patches (TIL telling send-email 'n' will still send the
remaining patches =P). Half way through composing, I realized that I was
probably missing untracked .dtbs thanks to .gitignore.
Anyway, so the first patch uses *.test.dtb suffix, or *test_tree1.dtb suffixes
to delete instead of *.dtb so that an included .dtb won't be eliminated. It
would've been easier to just to suffix the one file I wanted to include, but I
tried to take a hint from the test.dts. The only hack is that the other dtbs
generated by "make tests" are explicitly included in the cleanup list.
This is pretty invasive for a test of a five character patch, but it should
make it easier if binary tests are added later.
Other patch is the same as the previous ones, just merged and with the test.dts
name change.
- Jack
--
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] 5+ messages in thread
* [PATCH 1/2] Selective .dtb deletion on make clean
[not found] ` <1403639439-1032-1-git-send-email-jack-jZyo8ZIaZD9AfugRpC6u6w@public.gmane.org>
@ 2014-06-24 19:50 ` Jack Miller
[not found] ` <1403639439-1032-2-git-send-email-jack-jZyo8ZIaZD9AfugRpC6u6w@public.gmane.org>
2014-06-24 19:50 ` [PATCH 2/2] Properly handle nul delimited string lists Jack Miller
1 sibling, 1 reply; 5+ messages in thread
From: Jack Miller @ 2014-06-24 19:50 UTC (permalink / raw)
To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
Any .dtb generated by the tests is now suffixed with .test.dtb. The
.dtbs create by `make tests` are now explicitly named in the Makefile
cleanup list.
tl;dr make it possible to include a prebuilt .dtb in the tests directory
without make clean getting it.
---
tests/Makefile.tests | 2 +-
tests/run_tests.sh | 26 +++++++++++++-------------
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/tests/Makefile.tests b/tests/Makefile.tests
index 9adedec..05b1aa1 100644
--- a/tests/Makefile.tests
+++ b/tests/Makefile.tests
@@ -41,7 +41,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 *.dtsv1 tmp.*
+TESTS_CLEANFILES_L = *.output vglog.* vgcore.* *test_tree1.dtb bad_node_format.dtb bad_node_char.dtb bad_prop_char.dtb *.test.dtb *.test.dts *.dtsv1 tmp.*
TESTS_CLEANFILES_L += dumptrees
TESTS_CLEANFILES = $(TESTS) $(TESTS_CLEANFILES_L:%=$(TESTS_PREFIX)%)
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index f94d361..68da4b5 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -263,8 +263,8 @@ libfdt_tests () {
tree1_tests_rw noppy.$basetree
done
- run_dtc_test -I dts -O dtb -o subnode_iterate.dtb subnode_iterate.dts
- run_test subnode_iterate subnode_iterate.dtb
+ run_dtc_test -I dts -O dtb -o subnode_iterate.test.dtb subnode_iterate.dts
+ run_test subnode_iterate subnode_iterate.test.dtb
# Tests for behaviour on various sorts of corrupted trees
run_test truncated_property
@@ -308,8 +308,8 @@ dtc_tests () {
run_test phandle_format dtc_references.test.dtb both
for f in legacy epapr both; do
- run_dtc_test -I dts -O dtb -H $f -o dtc_references.test.$f.dtb references.dts
- run_test phandle_format dtc_references.test.$f.dtb $f
+ run_dtc_test -I dts -O dtb -H $f -o dtc_references.$f.test.dtb references.dts
+ run_test phandle_format dtc_references.$f.test.dtb $f
done
run_dtc_test -I dts -O dtb -o multilabel.test.dtb multilabel.dts
@@ -322,9 +322,9 @@ dtc_tests () {
run_test dtbs_equal_ordered dtc_comments.test.dtb dtc_comments-cmp.test.dtb
# Check aliases support in fdt_path_offset
- run_dtc_test -I dts -O dtb -o aliases.dtb aliases.dts
- run_test get_alias aliases.dtb
- run_test path_offset_aliases aliases.dtb
+ run_dtc_test -I dts -O dtb -o aliases.test.dtb aliases.dts
+ run_test get_alias aliases.test.dtb
+ run_test path_offset_aliases aliases.test.dtb
# Check /include/ directive
run_dtc_test -I dts -O dtb -o includes.test.dtb include0.dts
@@ -470,14 +470,14 @@ dtc_tests () {
run_wrap_test cmp dependencies.test.d dependencies.cmp
# Search paths
- run_wrap_error_test $DTC -I dts -O dtb -o search_paths.dtb search_paths.dts
- run_dtc_test -i search_dir -I dts -O dtb -o search_paths.dtb \
+ run_wrap_error_test $DTC -I dts -O dtb -o search_paths.test.dtb search_paths.dts
+ run_dtc_test -i search_dir -I dts -O dtb -o search_paths.test.dtb \
search_paths.dts
run_wrap_error_test $DTC -i search_dir_b -I dts -O dtb \
- -o search_paths_b.dtb search_paths_b.dts
+ -o search_paths_b.test.dtb search_paths_b.dts
run_dtc_test -i search_dir_b -i search_dir -I dts -O dtb \
- -o search_paths_b.dtb search_paths_b.dts
- run_dtc_test -I dts -O dtb -o search_paths_subdir.dtb \
+ -o search_paths_b.test.dtb search_paths_b.dts
+ run_dtc_test -I dts -O dtb -o search_paths_subdir.test.dtb \
search_dir_b/search_paths_subdir.dts
}
@@ -618,7 +618,7 @@ fdtdump_tests () {
return
local dts=fdtdump.dts
- local dtb=fdtdump.dts.dtb
+ local dtb=fdtdump.dts.test.dtb
local out=fdtdump.dts.out
run_dtc_test -O dtb $dts -o ${dtb}
$FDTDUMP ${dtb} | grep -v "//" >${out}
--
2.0.0
--
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] 5+ messages in thread
* [PATCH 2/2] Properly handle nul delimited string lists
[not found] ` <1403639439-1032-1-git-send-email-jack-jZyo8ZIaZD9AfugRpC6u6w@public.gmane.org>
2014-06-24 19:50 ` [PATCH 1/2] Selective .dtb deletion on make clean Jack Miller
@ 2014-06-24 19:50 ` Jack Miller
1 sibling, 0 replies; 5+ messages in thread
From: Jack Miller @ 2014-06-24 19:50 UTC (permalink / raw)
To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
reserved-names="res1\0res2\0res3";
Where \0 is a true embedded nul in the DTS source, should properly turn
into a string list. To achieve this, use the len given by the lexer
instead of strlen.
Without this patch dtc will mangle the output and possible hang on
realloc.
---
data.c | 2 +-
tests/nul_string_list.dtb | Bin 0 -> 127 bytes
tests/nul_string_list.dts | Bin 0 -> 66 bytes
tests/run_tests.sh | 3 +++
4 files changed, 4 insertions(+), 1 deletion(-)
create mode 100644 tests/nul_string_list.dtb
create mode 100644 tests/nul_string_list.dts
diff --git a/data.c b/data.c
index 4c50b12..8cae237 100644
--- a/data.c
+++ b/data.c
@@ -74,7 +74,7 @@ struct data data_copy_escape_string(const char *s, int len)
struct data d;
char *q;
- d = data_grow_for(empty_data, strlen(s)+1);
+ d = data_grow_for(empty_data, len + 1);
q = d.val;
while (i < len) {
diff --git a/tests/nul_string_list.dtb b/tests/nul_string_list.dtb
new file mode 100644
index 0000000000000000000000000000000000000000..ea2bc3915d8129c849d2cc7b247bc9d1a201256c
GIT binary patch
literal 127
zcmcb>`|m9S14BI!TL5tZ5NiOjAP@@xF$nMjF-Q&_FhT{GfwVM;U6fj!T2z*52xAz*
W7{*|gOhA$oswPD@FEKZ@m;nI8VH4E=
literal 0
HcmV?d00001
diff --git a/tests/nul_string_list.dts b/tests/nul_string_list.dts
new file mode 100644
index 0000000000000000000000000000000000000000..845a14425fd36db3fac2934d1412dbb2cd8fb3a9
GIT binary patch
literal 66
zcmdN-DJj-1Gt{@{;?h^B=He_$Elw>eOHI+uOUz9zR<Ko2f{GY2Kp93bhOv@0SFJS{
E0H@#-od5s;
literal 0
HcmV?d00001
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 68da4b5..44ef118 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -321,6 +321,9 @@ dtc_tests () {
run_dtc_test -I dts -O dtb -o dtc_comments-cmp.test.dtb comments-cmp.dts
run_test dtbs_equal_ordered dtc_comments.test.dtb dtc_comments-cmp.test.dtb
+ run_dtc_test -I dts -O dtb -o dtc_nul_string_list.test.dtb nul_string_list.dts
+ run_test dtbs_equal_ordered dtc_nul_string_list.test.dtb nul_string_list.dtb
+
# Check aliases support in fdt_path_offset
run_dtc_test -I dts -O dtb -o aliases.test.dtb aliases.dts
run_test get_alias aliases.test.dtb
--
2.0.0
--
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] 5+ messages in thread
* Re: [PATCH 1/2] Selective .dtb deletion on make clean
[not found] ` <1403639439-1032-2-git-send-email-jack-jZyo8ZIaZD9AfugRpC6u6w@public.gmane.org>
@ 2014-07-04 13:33 ` David Gibson
0 siblings, 0 replies; 5+ messages in thread
From: David Gibson @ 2014-07-04 13:33 UTC (permalink / raw)
To: Jack Miller; +Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 850 bytes --]
On Tue, Jun 24, 2014 at 02:50:38PM -0500, Jack Miller wrote:
> Any .dtb generated by the tests is now suffixed with .test.dtb. The
> .dtbs create by `make tests` are now explicitly named in the Makefile
> cleanup list.
>
> tl;dr make it possible to include a prebuilt .dtb in the tests directory
> without make clean getting it.
Hrm, yeah, this is a bit mucky. I think I'm seeing why I haven't
put prebuilt .dtbs into the tree before now.
Hmm. Sorry, I know I'm changing my mind inconveniently here, but can
we redo this without the prebuilt dtb - build it from a dts using the
normal string escapes, or a bytestring representation.
--
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] 5+ messages in thread
end of thread, other threads:[~2014-07-04 13:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-24 19:50 [PATCH] Nul delimiter redux Jack Miller
[not found] ` <1403639439-1032-1-git-send-email-jack-jZyo8ZIaZD9AfugRpC6u6w@public.gmane.org>
2014-06-24 19:50 ` [PATCH 1/2] Selective .dtb deletion on make clean Jack Miller
[not found] ` <1403639439-1032-2-git-send-email-jack-jZyo8ZIaZD9AfugRpC6u6w@public.gmane.org>
2014-07-04 13:33 ` David Gibson
2014-06-24 19:50 ` [PATCH 2/2] Properly handle nul delimited string lists Jack Miller
-- strict thread matches above, loose matches on Subject: below --
2014-06-24 18:31 Jack Miller
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).