aboutsummaryrefslogtreecommitdiff
path: root/tools/binman/cbfs_util_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/binman/cbfs_util_test.py')
-rwxr-xr-xtools/binman/cbfs_util_test.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/tools/binman/cbfs_util_test.py b/tools/binman/cbfs_util_test.py
index 19086305af1..9bb6a298222 100755
--- a/tools/binman/cbfs_util_test.py
+++ b/tools/binman/cbfs_util_test.py
@@ -290,13 +290,23 @@ class TestCbfs(unittest.TestCase):
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_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 offset', str(e.exception))
+ self.assertIn('No space for data before pad offset', str(e.exception))
def test_cbfs_bad_header_ptr(self):
"""Check handling of a bad master-header pointer"""
@@ -535,6 +545,17 @@ class TestCbfs(unittest.TestCase):
cbfs_fname = self._get_expected_cbfs(size=size, compress=['lz4', 'lzma'])
self._compare_expected_cbfs(data, cbfs_fname)
+ def test_cbfs_raw_space(self):
+ """Test files with unused space in the CBFS"""
+ size = 0xf0
+ cbw = CbfsWriter(size)
+ cbw.add_file_raw('u-boot', U_BOOT_DATA)
+ cbw.add_file_raw('u-boot-dtb', U_BOOT_DTB_DATA)
+ data = cbw.get_data()
+ self._check_raw(data, size)
+ cbfs_fname = self._get_expected_cbfs(size=size)
+ self._compare_expected_cbfs(data, cbfs_fname)
+
if __name__ == '__main__':
unittest.main()