From: Moteen Shah <m-s...@ti.com>

Add a testcase to ensure that scan_and_prop_bootph() actually
propagates bootph-* properties to supernodes.

Signed-off-by: Moteen Shah <m-s...@ti.com>
Signed-off-by: Simon Glass <s...@chromium.org>
---

 tools/binman/ftest.py                 | 18 ++++++++++++++++++
 tools/binman/test/347_bootph_prop.dts | 19 +++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 tools/binman/test/347_bootph_prop.dts

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 92df2a03650..8c019a4dcf3 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -8000,5 +8000,23 @@ fdt         fdtmap                Extract the devicetree 
blob from the fdtmap
         self._DoTestFile('346_remove_template.dts',
                          force_missing_bintools='openssl',)
 
+    def testBootphPropagation(self):
+        """Test that bootph-* properties are propagated correctly to 
supernodes"""
+        data, _, _, out_dtb_fname = self._DoReadFileDtb('347_bootph_prop.dts',
+                                                        use_real_dtb=True, 
update_dtb=True)
+        dtb = fdt.Fdt(out_dtb_fname)
+        dtb.Scan()
+        root = dtb.GetRoot()
+        parent_node = root.FindNode('dummy-parent')
+        subnode1 = parent_node.FindNode('subnode-1')
+        subnode2 = parent_node.FindNode('subnode-2')
+        subnode3 = parent_node.FindNode('subnode-3')
+
+        self.assertIn('bootph-pre-ram', subnode1.props, "Child node is missing 
'bootph-pre-ram' property")
+        self.assertIn('bootph-all', subnode1.props, "Child node is missing 
'bootph-all' property")
+        self.assertIn('bootph-pre-ram', parent_node.props, "Parent node is 
missing 'bootph-pre-ram' property")
+        self.assertIn('bootph-all', parent_node.props, "Parent node is missing 
'bootph-all' property")
+
+
 if __name__ == "__main__":
     unittest.main()
diff --git a/tools/binman/test/347_bootph_prop.dts 
b/tools/binman/test/347_bootph_prop.dts
new file mode 100644
index 00000000000..02bcf2d6f37
--- /dev/null
+++ b/tools/binman/test/347_bootph_prop.dts
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+/ {
+       dummy-parent {
+               subnode-1 {
+                       subnode-2 {
+                               bootph-all;
+                       };
+                       subnode-3 {
+                               bootph-pre-ram;
+                       };
+               };
+       };
+
+       binman: binman {
+       };
+};
+
-- 
2.43.0

base-commit: 4446bc331c65d3efb8a9321d6368c61edb56479b
branch: try-ti2

Reply via email to