summaryrefslogtreecommitdiff
path: root/tools/dtoc/test_fdt.py
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-08-01 14:41:22 -0400
committerTom Rini <trini@konsulko.com>2021-08-01 14:41:22 -0400
commit72ffb41a873722993d89c02bae4743a8ad6f16f9 (patch)
tree2508a115df4604adc9395b4f72e8ec3ec8fff90f /tools/dtoc/test_fdt.py
parent5371593aed56ee11cbb6cc6ac8d058fcd9b8f58c (diff)
parenteec44c7218a3c3ce924a282cc46a59e83feb9de1 (diff)
Merge tag 'dm-pull-1aug21' of https://source.denx.de/u-boot/custodians/u-boot-dm
sandbox TPM-emulator improvements rST documentation and fixes for moveconfig handle empty 'ranges' property in dtoc patman warning for invalid tag clean-ups to 'fdt add' command
Diffstat (limited to 'tools/dtoc/test_fdt.py')
-rwxr-xr-xtools/dtoc/test_fdt.py29
1 files changed, 26 insertions, 3 deletions
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index 856392b1bd9..1119e6b7847 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -122,8 +122,9 @@ class TestFdt(unittest.TestCase):
node = self.dtb.GetNode('/spl-test')
props = self.dtb.GetProps(node)
self.assertEqual(['boolval', 'bytearray', 'byteval', 'compatible',
- 'intarray', 'intval', 'longbytearray', 'notstring',
- 'stringarray', 'stringval', 'u-boot,dm-pre-reloc'],
+ 'intarray', 'intval', 'longbytearray',
+ 'maybe-empty-int', 'notstring', 'stringarray',
+ 'stringval', 'u-boot,dm-pre-reloc'],
sorted(props.keys()))
def testCheckError(self):
@@ -379,7 +380,7 @@ class TestProp(unittest.TestCase):
self.assertEqual(Type.INT, prop.type)
self.assertEqual(1, fdt32_to_cpu(prop.value))
- # Convert singla value to array
+ # Convert single value to array
prop2 = self.node.props['intarray']
prop.Widen(prop2)
self.assertEqual(Type.INT, prop.type)
@@ -422,6 +423,28 @@ class TestProp(unittest.TestCase):
self.assertTrue(isinstance(prop.value, list))
self.assertEqual(3, len(prop.value))
+ # Widen an array of ints with an int (should do nothing)
+ prop = self.node.props['intarray']
+ prop2 = node2.props['intarray']
+ self.assertEqual(Type.INT, prop.type)
+ self.assertEqual(3, len(prop.value))
+ prop.Widen(prop2)
+ self.assertEqual(Type.INT, prop.type)
+ self.assertEqual(3, len(prop.value))
+
+ # Widen an empty bool to an int
+ prop = self.node.props['maybe-empty-int']
+ prop3 = node3.props['maybe-empty-int']
+ self.assertEqual(Type.BOOL, prop.type)
+ self.assertEqual(True, prop.value)
+ self.assertEqual(Type.INT, prop3.type)
+ self.assertFalse(isinstance(prop.value, list))
+ self.assertEqual(4, len(prop3.value))
+ prop.Widen(prop3)
+ self.assertEqual(Type.INT, prop.type)
+ self.assertTrue(isinstance(prop.value, list))
+ self.assertEqual(1, len(prop.value))
+
def testAdd(self):
"""Test adding properties"""
self.fdt.pack()