+ def testUpdateFdt(self):
+ """Test that we can update the device tree with pos/size info"""
+ _, _, _, out_dtb_fname = self._DoReadFileDtb('60_fdt_update.dts',
+ update_dtb=True)
+ props = self._GetPropTree(out_dtb_fname, ['pos', 'size'])
+ with open('/tmp/x.dtb', 'wb') as outf:
+ with open(out_dtb_fname) as inf:
+ outf.write(inf.read())
+ self.assertEqual({
+ '_testing:pos': 32,
+ '_testing:size': 1,
+ 'section@0/u-boot:pos': 0,
+ 'section@0/u-boot:size': len(U_BOOT_DATA),
+ 'section@0:pos': 0,
+ 'section@0:size': 16,
+
+ 'section@1/u-boot:pos': 0,
+ 'section@1/u-boot:size': len(U_BOOT_DATA),
+ 'section@1:pos': 16,
+ 'section@1:size': 16,
+ 'size': 40
+ }, props)
+
+ def testUpdateFdtBad(self):
+ """Test that we detect when ProcessFdt never completes"""
+ with self.assertRaises(ValueError) as e:
+ self._DoReadFileDtb('61_fdt_update_bad.dts', update_dtb=True)
+ self.assertIn('Could not complete processing of Fdt: remaining '
+ '[<_testing.Entry__testing', str(e.exception))