]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
tools: binman: ftest.py: Add testcase for bootph-* propagation
authorMoteen Shah <m-shah@ti.com>
Fri, 16 May 2025 11:41:48 +0000 (17:11 +0530)
committerTom Rini <trini@konsulko.com>
Thu, 26 Jun 2025 17:48:37 +0000 (11:48 -0600)
Add a testcase to ensure that scan_and_prop_bootph() actually
propagates bootph-* properties to supernodes.

Signed-off-by: Moteen Shah <m-shah@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
tools/binman/ftest.py
tools/binman/test/347_bootph_prop.dts [new file with mode: 0644]

index fa17490001488a297090a65c0c099ecc9a40e0f8..1bbb5e2b2ab6a7f465b26fe739c89705a2fe9dea 100644 (file)
@@ -8011,5 +8011,29 @@ 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"""
+        _, _, _, 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 = subnode1.FindNode('subnode-2')
+        subnode3 = subnode1.FindNode('subnode-3')
+        subnode4 = subnode3.FindNode('subnode-4')
+
+        self.assertIn('bootph-some-ram', subnode1.props,
+                      "Child node is missing 'bootph-some-ram' property")
+        self.assertIn('bootph-all', subnode1.props,
+                      "Child node is missing 'bootph-all' property")
+        self.assertIn('bootph-some-ram', parent_node.props,
+                      "Parent node is missing 'bootph-some-ram' property")
+        self.assertIn('bootph-all', parent_node.props,
+                      "Parent node is missing 'bootph-all' property")
+        self.assertEqual(len(subnode4.props), 0,
+                        "subnode shouldn't have any properties")
+
 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 (file)
index 0000000..91d4e4a
--- /dev/null
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+/ {
+       dummy-parent {
+               subnode-1 {
+                       subnode-2 {
+                               bootph-all;
+                       };
+                       subnode-3 {
+                               bootph-some-ram;
+                               subnode-4 {
+                               };
+                       };
+               };
+       };
+
+       binman: binman {
+       };
+};
+