def test_cbfs_no_space_pad(self): """Check handling of running out of space in CBFS with file header""" size = 0x70 cbw = CbfsWriter(size) cbw._add_fileheader = True cbw.add_file_raw('u-boot', U_BOOT_DATA) with self.assertRaises(ValueError) as e: cbw.get_data() self.assertIn('No space for data before pad offset', str(e.exception))
def test_cbfs_no_space_skip(self): """Check handling of running out of space in CBFS with file header""" size = 0x5c cbw = CbfsWriter(size, arch=cbfs_util.ARCHITECTURE_PPC64) cbw._add_fileheader = True cbw.add_file_raw('u-boot', U_BOOT_DATA) with self.assertRaises(ValueError) as e: cbw.get_data() self.assertIn('No space for data before offset', str(e.exception))
def test_cbfs_file_master_header(self): """Check handling of a file containing a master header""" size = 0x100 cbw = CbfsWriter(size) cbw._add_fileheader = True cbw.add_file_raw('u-boot', U_BOOT_DATA) data = cbw.get_data() cbr = cbfs_util.CbfsReader(data) self.assertIn('u-boot', cbr.files) self.assertEqual(size, cbr.rom_size)