diff options
author | Luca Weiss <luca@z3ntu.xyz> | 2021-12-25 14:25:55 +0100 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2021-12-28 15:29:31 +1100 |
commit | 83102717d7c4171aeb2d26941fa1ee2997bf4a7d (patch) | |
tree | 19ca9d3f31a5ff59d17c25212f5820cbe8060da3 /tests | |
parent | d152126bb0293c321cae437bdf7437c393ee3619 (diff) | |
download | dtc-83102717d7c4171aeb2d26941fa1ee2997bf4a7d.zip dtc-83102717d7c4171aeb2d26941fa1ee2997bf4a7d.tar.gz dtc-83102717d7c4171aeb2d26941fa1ee2997bf4a7d.tar.bz2 |
pylibfdt: add Property.as_stringlist()
Add a new method for decoding a string list property, useful for e.g.
the "reg-names" property.
Also add a test for the new method.
Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
Message-Id: <20211225132558.167123-2-luca@z3ntu.xyz>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pylibfdt_tests.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/pylibfdt_tests.py b/tests/pylibfdt_tests.py index 64b5bd1..7e3cc4c 100644 --- a/tests/pylibfdt_tests.py +++ b/tests/pylibfdt_tests.py @@ -382,6 +382,14 @@ class PyLibfdtBasicTests(unittest.TestCase): self.get_prop("prop-uint64").as_uint64()) self.assertEqual(-2, self.get_prop("prop-int64").as_int64()) + def testGetStringlistProperties(self): + """Test that we can access properties as string list""" + node = self.fdt.path_offset('/subnode@1/subsubnode') + self.assertEqual(["subsubnode1", "subsubnode"], + self.fdt.getprop(node, "compatible").as_stringlist()) + self.assertEqual(["this is a placeholder string", "string2"], + self.fdt.getprop(node, "placeholder").as_stringlist()) + def testReserveMap(self): """Test that we can access the memory reserve map""" self.assertEqual(2, self.fdt.num_mem_rsv()) |