diff options
author | Simon Glass <sjg@chromium.org> | 2018-07-17 22:25:51 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-08-02 01:30:48 +0300 |
commit | 15a587c9cec246ec69d96fce8f146e0c835b3670 (patch) | |
tree | 3ba593695af28a158b65679afeded76bf77d0534 /tools | |
parent | 7e7c587760ca42f47d9a3b6869f39f7c309f50e1 (diff) | |
download | u-boot-15a587c9cec246ec69d96fce8f146e0c835b3670.tar.xz |
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>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/binman/entry.py | 2 | ||||
-rw-r--r-- | tools/binman/ftest.py | 7 | ||||
-rw-r--r-- | tools/binman/test/79_uses_pos.dts | 10 |
3 files changed, 19 insertions, 0 deletions
diff --git a/tools/binman/entry.py b/tools/binman/entry.py index 6ce5dbdc90..77cfab9c5d 100644 --- a/tools/binman/entry.py +++ b/tools/binman/entry.py @@ -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') diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index ce473dfaff..3d5f23558c 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -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 index 0000000000..7638b9b5e0 --- /dev/null +++ b/tools/binman/test/79_uses_pos.dts @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + binman { + u-boot { + pos = <10>; + }; + }; +}; |