Example #1
0
    def testGetByte(self):
        self.assertEqual(5, fdt_util.GetByte(self.node, 'byteval'))
        self.assertEqual(3, fdt_util.GetByte(self.node, 'missing', 3))

        with self.assertRaises(ValueError) as e:
            fdt_util.GetByte(self.node, 'longbytearray')
        self.assertIn("property 'longbytearray' has list value: expecting a "
                      'single byte', str(e.exception))

        with self.assertRaises(ValueError) as e:
            fdt_util.GetByte(self.node, 'intval')
        self.assertIn("property 'intval' has length 4, expecting 1",
                      str(e.exception))
Example #2
0
 def ReadNode(self):
     super().ReadNode()
     if self.size is None:
         self.Raise("'u-boot-env' entry must have a size property")
     self.fill_value = fdt_util.GetByte(self._node, 'fill-byte', 0)
Example #3
0
 def ReadNode(self):
     Entry.ReadNode(self)
     if self.size is None:
         self.Raise("'fill' entry must have a size property")
     self.fill_value = fdt_util.GetByte(self._node, 'fill-byte', 0)