diff options
author | Uwe Kleine-König <u.kleine-koenig@baylibre.com> | 2025-08-18 12:35:46 +0200 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2025-08-20 21:34:05 +1000 |
commit | e1284ee5dc20f94097bc6424ede9c3e433dba77d (patch) | |
tree | b8f6610715f3b15a007b7c847b374bb2c7347a40 /tests | |
parent | cba90ce82064ad1e6d25f20d8eaa940bd2fc97ed (diff) | |
download | dtc-e1284ee5dc20f94097bc6424ede9c3e433dba77d.zip dtc-e1284ee5dc20f94097bc6424ede9c3e433dba77d.tar.gz dtc-e1284ee5dc20f94097bc6424ede9c3e433dba77d.tar.bz2 |
livetree: Add only new data to fixup nodes instead of complete regeneration
Removing the complete __fixups__ and __local_fixups__ tree might delete
data that should better be retained. See the added test for a situation
that was broken before.
Note that without removing /__fixups__ and /__local_fixups__ in
generate_fixups_tree() and generate_local_fixups_tree() respectively
calling build_and_name_child_node() isn't safe as the nodes might
already exist and then a duplicate would be added. So build_root_node()
has to be used which copes correctly here.
Fixes: 915daadbb62d ("Start with empty __local_fixups__ and __fixups__ nodes")
Closes: https://github.com/dgibson/dtc/issues/170
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Message-ID: <b061ee57157fafbb9d5b9b0b86af760d13a04eda.1755512759.git.u.kleine-koenig@baylibre.com>
[dwg: Use -1 instead of 1 as an error return]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/retain-fixups.dts | 29 | ||||
-rwxr-xr-x | tests/run_tests.sh | 5 |
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/retain-fixups.dts b/tests/retain-fixups.dts new file mode 100644 index 0000000..ec09db8 --- /dev/null +++ b/tests/retain-fixups.dts @@ -0,0 +1,29 @@ +/dts-v1/; +/plugin/; + +/ { + fixup-node { + property = <0xffffffff>; + property-with-fixup = <0xffffffff>; + property-with-label = <&somenode>; + property-with-label-and-fixup = <&somenode>; + }; + + label: local-fixup-node { + property = <0xffffffff>; + property-with-local-fixup = <0xffffffff>; + property-with-local-label = <&label>; + property-with-local-label-and-fixup = <&label>; + }; + + __fixups__ { + somenode = "/fixup-node:property-with-fixup:0", "/fixup-node:property-with-label-and-fixup:0"; + }; + + __local_fixups__ { + local-fixup-node { + property-with-local-fixup = <0x00>; + property-with-local-label-and-fixup = <0x00>; + }; + }; +}; diff --git a/tests/run_tests.sh b/tests/run_tests.sh index 6c60488..f07092b 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -667,6 +667,11 @@ dtc_tests () { run_test dtbs_equal_ordered $tree.test.dtb $tree.test.dts.test.dtb done + # Check preservation of __fixups__ and __local_fixups__ + run_dtc_test -I dts -O dtb -o retain-fixups.test.dtb "$SRCDIR/retain-fixups.dts" + run_fdtget_test "/fixup-node:property-with-fixup:0 /fixup-node:property-with-label-and-fixup:0 /fixup-node:property-with-label:0" retain-fixups.test.dtb /__fixups__ somenode + run_fdtget_test "property-with-local-fixup\nproperty-with-local-label-and-fixup\nproperty-with-local-label" -p retain-fixups.test.dtb /__local_fixups__/local-fixup-node + # Check -Oyaml output if ! $no_yaml; then for tree in type-preservation; do |