]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
binman: Add a test to catch use of the old 'pos' property
authorSimon Glass <sjg@chromium.org>
Tue, 17 Jul 2018 19:25:51 +0000 (13:25 -0600)
committerSimon Glass <sjg@chromium.org>
Wed, 1 Aug 2018 22:30:48 +0000 (16:30 -0600)
This property has been changed to 'offset'. To help downstream users who
might still be using 'pos', add a check that this is not used by mistake.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/binman/entry.py
tools/binman/ftest.py
tools/binman/test/79_uses_pos.dts [new file with mode: 0644]

index 6ce5dbdc90ffc686b219a178904235ef42a50323..77cfab9c5de0419d09c26aec272c2cb2252012a2 100644 (file)
@@ -143,6 +143,8 @@ class Entry(object):
 
         This reads all the fields we recognise from the node, ready for use.
         """
+        if 'pos' in self._node.props:
+            self.Raise("Please use 'offset' instead of 'pos'")
         self.offset = fdt_util.GetInt(self._node, 'offset')
         self.size = fdt_util.GetInt(self._node, 'size')
         self.align = fdt_util.GetInt(self._node, 'align')
index ce473dfaffbf4de6665db0cb0ae6f0f3b85914ca..3d5f23558c55cdf561dcffc2af8a5a470b617b22 100644 (file)
@@ -1361,6 +1361,13 @@ class TestFunctional(unittest.TestCase):
         data = self._DoReadFile('78_u_boot_tpl.dts')
         self.assertEqual(U_BOOT_TPL_DATA + U_BOOT_TPL_DTB_DATA, data)
 
+    def testUsesPos(self):
+        """Test that the 'pos' property cannot be used anymore"""
+        with self.assertRaises(ValueError) as e:
+           data = self._DoReadFile('79_uses_pos.dts')
+        self.assertIn("Node '/binman/u-boot': Please use 'offset' instead of "
+                      "'pos'", str(e.exception))
+
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/tools/binman/test/79_uses_pos.dts b/tools/binman/test/79_uses_pos.dts
new file mode 100644 (file)
index 0000000..7638b9b
--- /dev/null
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0+
+/dts-v1/;
+
+/ {
+       binman {
+               u-boot {
+                       pos = <10>;
+               };
+       };
+};