mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-19 13:41:31 +00:00
binman: Add a test to catch use of the old 'pos' property
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>
This commit is contained in:
parent
7e7c587760
commit
15a587c9ce
3 changed files with 19 additions and 0 deletions
|
@ -143,6 +143,8 @@ class Entry(object):
|
||||||
|
|
||||||
This reads all the fields we recognise from the node, ready for use.
|
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.offset = fdt_util.GetInt(self._node, 'offset')
|
||||||
self.size = fdt_util.GetInt(self._node, 'size')
|
self.size = fdt_util.GetInt(self._node, 'size')
|
||||||
self.align = fdt_util.GetInt(self._node, 'align')
|
self.align = fdt_util.GetInt(self._node, 'align')
|
||||||
|
|
|
@ -1361,6 +1361,13 @@ class TestFunctional(unittest.TestCase):
|
||||||
data = self._DoReadFile('78_u_boot_tpl.dts')
|
data = self._DoReadFile('78_u_boot_tpl.dts')
|
||||||
self.assertEqual(U_BOOT_TPL_DATA + U_BOOT_TPL_DTB_DATA, data)
|
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__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
10
tools/binman/test/79_uses_pos.dts
Normal file
10
tools/binman/test/79_uses_pos.dts
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0+
|
||||||
|
/dts-v1/;
|
||||||
|
|
||||||
|
/ {
|
||||||
|
binman {
|
||||||
|
u-boot {
|
||||||
|
pos = <10>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
Loading…
Add table
Reference in a new issue