[Crosstoolchain-logs] [device-tree-compiler] 288/357: dtc: Run relevant checks on dtb input as well as dts
Hector Oron
zumbi at moszumanska.debian.org
Thu Dec 8 17:06:24 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 4d7bea7873590ee3a2bfc2905bef3ed8e84a0902
Author: David Gibson <david at gibson.dropbear.id.au>
Date: Mon Jul 7 11:19:13 2008 +1000
dtc: Run relevant checks on dtb input as well as dts
This patch adjusts the testsuite to run most of the tests for the tree
checking code on input in dtb form as well as dts form. Some checks
which only make sense for dts input (like reference handling) are
excluded, as are those which currently take dtb input because they
rely on things which cannot be lexically constructed in a dts file.
This shows up two small bugs in dtc, which are also corrected.
First, the name_properties test which was is supposed to remove
correctly formed 'name' properties (because they can be reconstructed
from tne node name) was instead removing 'name' properties even if
they weren't correct.
Secondly, when using dtb or fs input, the runtime tree in dtc did not
have the parent pointer initialized propertly because.built
internally. The appropriate initialization is added to the
add_child() function.
Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
---
checks.c | 16 +++++++++-------
livetree.c | 1 +
tests/run_tests.sh | 36 ++++++++++++++++++++++--------------
3 files changed, 32 insertions(+), 21 deletions(-)
diff --git a/checks.c b/checks.c
index 0066fb3..9548579 100644
--- a/checks.c
+++ b/checks.c
@@ -328,15 +328,17 @@ static void check_name_properties(struct check *c, struct node *root,
return; /* No name property, that's fine */
if ((prop->val.len != node->basenamelen+1)
- || (memcmp(prop->val.val, node->name, node->basenamelen) != 0))
+ || (memcmp(prop->val.val, node->name, node->basenamelen) != 0)) {
FAIL(c, "\"name\" property in %s is incorrect (\"%s\" instead"
" of base node name)", node->fullpath, prop->val.val);
-
- /* The name property is correct, and therefore redundant. Delete it */
- *pp = prop->next;
- free(prop->name);
- data_free(prop->val);
- free(prop);
+ } else {
+ /* The name property is correct, and therefore redundant.
+ * Delete it */
+ *pp = prop->next;
+ free(prop->name);
+ data_free(prop->val);
+ free(prop);
+ }
}
CHECK_IS_STRING(name_is_string, "name", ERROR);
NODE_CHECK(name_properties, NULL, ERROR, &name_is_string);
diff --git a/livetree.c b/livetree.c
index ba7e263..0ca3de5 100644
--- a/livetree.c
+++ b/livetree.c
@@ -115,6 +115,7 @@ void add_child(struct node *parent, struct node *child)
struct node **p;
child->next_sibling = NULL;
+ child->parent = parent;
p = &parent->children;
while (*p)
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 976176b..7bfc399 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -115,6 +115,14 @@ tree1_tests_rw () {
run_test del_node $TREE
}
+check_tests () {
+ tree="$1"
+ shift
+ run_sh_test dtc-checkfails.sh "$@" -- -I dts -O dtb $tree
+ run_dtc_test -I dts -O dtb -o $tree.test.dtb -f $tree
+ run_sh_test dtc-checkfails.sh "$@" -- -I dtb -O dtb $tree.test.dtb
+}
+
ALL_LAYOUTS="mts mst tms tsm smt stm"
libfdt_tests () {
@@ -243,22 +251,22 @@ dtc_tests () {
done
# Check some checks
- run_sh_test dtc-checkfails.sh duplicate_node_names -- -I dts -O dtb dup-nodename.dts
- run_sh_test dtc-checkfails.sh duplicate_property_names -- -I dts -O dtb dup-propname.dts
- run_sh_test dtc-checkfails.sh explicit_phandles -- -I dts -O dtb dup-phandle.dts
- run_sh_test dtc-checkfails.sh explicit_phandles -- -I dts -O dtb zero-phandle.dts
- run_sh_test dtc-checkfails.sh explicit_phandles -- -I dts -O dtb minusone-phandle.dts
+ check_tests dup-nodename.dts duplicate_node_names
+ check_tests dup-propname.dts duplicate_property_names
+ check_tests dup-phandle.dts explicit_phandles
+ check_tests zero-phandle.dts explicit_phandles
+ check_tests minusone-phandle.dts explicit_phandles
run_sh_test dtc-checkfails.sh phandle_references -- -I dts -O dtb nonexist-node-ref.dts
run_sh_test dtc-checkfails.sh phandle_references -- -I dts -O dtb nonexist-label-ref.dts
- run_sh_test dtc-checkfails.sh name_properties -- -I dts -O dtb bad-name-property.dts
-
- run_sh_test dtc-checkfails.sh address_cells_is_cell size_cells_is_cell interrupt_cells_is_cell -- -I dts -O dtb bad-ncells.dts
- run_sh_test dtc-checkfails.sh device_type_is_string model_is_string status_is_string -- -I dts -O dtb bad-string-props.dts
- run_sh_test dtc-checkfails.sh reg_format ranges_format -- -I dts -O dtb bad-reg-ranges.dts
- run_sh_test dtc-checkfails.sh ranges_format -- -I dts -O dtb bad-empty-ranges.dts
- run_sh_test dtc-checkfails.sh reg_format ranges_format -- -I dts -O dtb reg-ranges-root.dts
- run_sh_test dtc-checkfails.sh avoid_default_addr_size -- -I dts -O dtb default-addr-size.dts
- run_sh_test dtc-checkfails.sh obsolete_chosen_interrupt_controller -- -I dts -O dtb obsolete-chosen-interrupt-controller.dts
+ check_tests bad-name-property.dts name_properties
+
+ check_tests bad-ncells.dts address_cells_is_cell size_cells_is_cell interrupt_cells_is_cell
+ check_tests bad-string-props.dts device_type_is_string model_is_string status_is_string
+ check_tests bad-reg-ranges.dts reg_format ranges_format
+ check_tests bad-empty-ranges.dts ranges_format
+ check_tests reg-ranges-root.dts reg_format ranges_format
+ check_tests default-addr-size.dts avoid_default_addr_size
+ check_tests obsolete-chosen-interrupt-controller.dts obsolete_chosen_interrupt_controller
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
--
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