diff options
author | Simon Glass <sjg@chromium.org> | 2021-11-24 07:09:51 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2021-12-05 19:22:41 +0300 |
commit | 1b5a5331f3c7ad3ae5688841a7a6e710a2cb4dc7 (patch) | |
tree | f9c4bae46589a5856d21b05a7c5725d7e67445c6 /tools/dtoc/test_fdt.py | |
parent | 943bf78a48ac22ce0277697976fef4f89457b446 (diff) | |
download | u-boot-1b5a5331f3c7ad3ae5688841a7a6e710a2cb4dc7.tar.xz |
dtoc: Add support for reading string-list properties
Add a function to read a list of strings from the devicetree.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/dtoc/test_fdt.py')
-rwxr-xr-x | tools/dtoc/test_fdt.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py index 7a4c7efaa4..55b70e9876 100755 --- a/tools/dtoc/test_fdt.py +++ b/tools/dtoc/test_fdt.py @@ -615,6 +615,15 @@ class TestFdtUtil(unittest.TestCase): self.assertIn("property 'stringarray' has list value: expecting a " 'single string', str(e.exception)) + def testGetStringList(self): + self.assertEqual(['message'], + fdt_util.GetStringList(self.node, 'stringval')) + self.assertEqual( + ['multi-word', 'message'], + fdt_util.GetStringList(self.node, 'stringarray')) + self.assertEqual(['test'], + fdt_util.GetStringList(self.node, 'missing', ['test'])) + def testGetBool(self): self.assertEqual(True, fdt_util.GetBool(self.node, 'boolval')) self.assertEqual(False, fdt_util.GetBool(self.node, 'missing')) |