[RFC PATCH v2 69/74] tests: fdtaddon: Add a test for addons with properties identical to existing ones

From: Herve Codina

Date: Wed Aug 26 2026 - 06:04:29 EST


An addon cannot modify or add a property in a existing node.

If an addon has a property with the exact same value as an existing one,
applying the addon doesn't lead to a property modification.

Indeed, because both properties (the addon one and the existing one) are
equal, the existing one is not modified.

Add a test for this feature.

Signed-off-by: Herve Codina <herve.codina@xxxxxxxxxxx>
---
...n_addon_prop_existing_ok-merged.dtb.expect | 20 +++++++++++++++
...dtaddon_addon_prop_existing_ok.dtba.expect | 17 +++++++++++++
tests/fdtaddon_addon_prop_existing_ok.dtsa | 25 +++++++++++++++++++
tests/fdtaddon_base_prop_existing.dtb.expect | 17 +++++++++++++
tests/fdtaddon_base_prop_existing.dts | 22 ++++++++++++++++
tests/run_tests.sh | 12 +++++++++
6 files changed, 113 insertions(+)
create mode 100644 tests/fdtaddon_addon_prop_existing_ok-merged.dtb.expect
create mode 100644 tests/fdtaddon_addon_prop_existing_ok.dtba.expect
create mode 100644 tests/fdtaddon_addon_prop_existing_ok.dtsa
create mode 100644 tests/fdtaddon_base_prop_existing.dtb.expect
create mode 100644 tests/fdtaddon_base_prop_existing.dts

diff --git a/tests/fdtaddon_addon_prop_existing_ok-merged.dtb.expect b/tests/fdtaddon_addon_prop_existing_ok-merged.dtb.expect
new file mode 100644
index 00000000..a49c3f36
--- /dev/null
+++ b/tests/fdtaddon_addon_prop_existing_ok-merged.dtb.expect
@@ -0,0 +1,20 @@
+/dts-v1/;
+
+/ {
+ base-node {
+ // [FDT_EXPORT_SYM] 'base' -> phandle 0x00000001
+ compatible = "abc,base";
+ exist_bool;
+ exist_int = <0x0000007b>;
+ exist_string = "abcdef";
+ phandle = <0x00000001>;
+ sub-node {
+ sub_exist_bool;
+ sub_exist_int = <0x000001c8>;
+ sub_exist_string = "ghi";
+ addon-node {
+ prop;
+ };
+ };
+ };
+};
diff --git a/tests/fdtaddon_addon_prop_existing_ok.dtba.expect b/tests/fdtaddon_addon_prop_existing_ok.dtba.expect
new file mode 100644
index 00000000..c16c38c7
--- /dev/null
+++ b/tests/fdtaddon_addon_prop_existing_ok.dtba.expect
@@ -0,0 +1,17 @@
+/dts-v1/;
+/addon/;
+
+// [FDT_IMPORT_SYM] 'base' (abc,base)
+&base {
+ exist_bool;
+ exist_int = <0x0000007b>;
+ exist_string = "abcdef";
+ sub-node {
+ sub_exist_bool;
+ sub_exist_int = <0x000001c8>;
+ sub_exist_string = "ghi";
+ addon-node {
+ prop;
+ };
+ };
+};
diff --git a/tests/fdtaddon_addon_prop_existing_ok.dtsa b/tests/fdtaddon_addon_prop_existing_ok.dtsa
new file mode 100644
index 00000000..16e525c1
--- /dev/null
+++ b/tests/fdtaddon_addon_prop_existing_ok.dtsa
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause)
+/*
+ * Copyright (C) 2026 Bootlin
+ */
+
+/dts-v1/;
+/addon/;
+
+/import/ base: "abc,base";
+
+&base {
+ exist_bool;
+ exist_int = <123>;
+ exist_string = "abcdef";
+
+ sub-node {
+ sub_exist_bool;
+ sub_exist_int = <456>;
+ sub_exist_string = "ghi";
+
+ addon-node {
+ prop;
+ };
+ };
+};
diff --git a/tests/fdtaddon_base_prop_existing.dtb.expect b/tests/fdtaddon_base_prop_existing.dtb.expect
new file mode 100644
index 00000000..2b9d3ac0
--- /dev/null
+++ b/tests/fdtaddon_base_prop_existing.dtb.expect
@@ -0,0 +1,17 @@
+/dts-v1/;
+
+/ {
+ base-node {
+ // [FDT_EXPORT_SYM] 'base' -> phandle 0x00000001
+ compatible = "abc,base";
+ exist_bool;
+ exist_int = <0x0000007b>;
+ exist_string = "abcdef";
+ phandle = <0x00000001>;
+ sub-node {
+ sub_exist_bool;
+ sub_exist_int = <0x000001c8>;
+ sub_exist_string = "ghi";
+ };
+ };
+};
diff --git a/tests/fdtaddon_base_prop_existing.dts b/tests/fdtaddon_base_prop_existing.dts
new file mode 100644
index 00000000..7b0f7102
--- /dev/null
+++ b/tests/fdtaddon_base_prop_existing.dts
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause)
+/*
+ * Copyright (C) 2026 Bootlin
+ */
+
+/dts-v1/;
+
+/ {
+ base_node: base-node {
+ compatible = "abc,base";
+ exist_bool;
+ exist_int = <123>;
+ exist_string = "abcdef";
+ /export/ base: &base_node;
+
+ sub-node {
+ sub_exist_bool;
+ sub_exist_int = <456>;
+ sub_exist_string = "ghi";
+ };
+ };
+};
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 5f09bf47..0182dffc 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -1322,6 +1322,18 @@ fdtaddon_tests() {
run_dtc_test -I dtb -O dts -o $dt-merged2.dtb.dts $dt-merged2.dtb
check_dts $dt-merged2.dtb.dts
done
+
+ # Test addon with exact same properties as ones available in the base tree
+ run_dtc_test -I dts -O dtb -o fdtaddon_base_prop_existing.dtb "$SRCDIR/fdtaddon_base_prop_existing.dts"
+ check_dtb fdtaddon_base_prop_existing.dtb
+
+ run_dtc_test -I dts -O dtb -o fdtaddon_addon_prop_existing_ok.dtba "$SRCDIR/fdtaddon_addon_prop_existing_ok.dtsa"
+ check_dtb fdtaddon_addon_prop_existing_ok.dtba
+
+ run_fdtaddon_test -i fdtaddon_base_prop_existing.dtb -o fdtaddon_addon_prop_existing_ok-merged.dtb \
+ -t "/base-node" fdtaddon_addon_prop_existing_ok.dtba
+ check_dtb fdtaddon_addon_prop_existing_ok-merged.dtb
+
}

pylibfdt_tests () {
--
2.55.0