summaryrefslogtreecommitdiff
path: root/tools/binman/elf_test.py
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2023-07-20 21:31:31 -0400
committerTom Rini <trini@konsulko.com>2023-07-20 21:31:31 -0400
commite896279ac39ebb97f23e6132bf7668a61e1cd86b (patch)
tree24e035ebd13dbd272da4b3845a1dfcac66e4a86f /tools/binman/elf_test.py
parent7fe5accb4516144b7abb8f183640cdf50423121e (diff)
parent24142ead21ed5e4d2d6f39dd410d91d815ea1ae2 (diff)
Merge tag 'dm-pull-20jul23' of https://source.denx.de/u-boot/custodians/u-boot-dm
binman mkimage and template enhancements misc fixes
Diffstat (limited to 'tools/binman/elf_test.py')
-rw-r--r--tools/binman/elf_test.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index c98083961b5..cc95b424b33 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -141,7 +141,8 @@ class TestElf(unittest.TestCase):
entry = FakeEntry(10)
section = FakeSection()
elf_fname = self.ElfTestFile('u_boot_binman_syms_bad')
- elf.LookupAndWriteSymbols(elf_fname, entry, section)
+ count = elf.LookupAndWriteSymbols(elf_fname, entry, section)
+ self.assertEqual(0, count)
def testBadSymbolSize(self):
"""Test that an attempt to use an 8-bit symbol are detected
@@ -162,7 +163,7 @@ class TestElf(unittest.TestCase):
def testNoValue(self):
"""Test the case where we have no value for the symbol
- This should produce -1 values for all thress symbols, taking up the
+ This should produce -1 values for all three symbols, taking up the
first 16 bytes of the image.
"""
if not elf.ELF_TOOLS:
@@ -170,7 +171,8 @@ class TestElf(unittest.TestCase):
entry = FakeEntry(28)
section = FakeSection(sym_value=None)
elf_fname = self.ElfTestFile('u_boot_binman_syms')
- elf.LookupAndWriteSymbols(elf_fname, entry, section)
+ count = elf.LookupAndWriteSymbols(elf_fname, entry, section)
+ self.assertEqual(5, count)
expected = (struct.pack('<L', elf.BINMAN_SYM_MAGIC_VALUE) +
tools.get_bytes(255, 20) +
tools.get_bytes(ord('a'), 4))
@@ -369,6 +371,11 @@ class TestElf(unittest.TestCase):
elf.GetSymbolOffset(fname, 'embed')
self.assertIn('__image_copy_start', str(e.exception))
+ def test_get_symbol_address(self):
+ fname = self.ElfTestFile('embed_data')
+ addr = elf.GetSymbolAddress(fname, 'region_size')
+ self.assertEqual(0, addr)
+
if __name__ == '__main__':
unittest.main()