aboutsummaryrefslogtreecommitdiff
path: root/tools/binman/elf_test.py
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-08-22 12:41:07 -0400
committerTom Rini <trini@konsulko.com>2022-08-22 12:41:07 -0400
commit850ac7ceb75d2f86f0feae48ee77ee663dcd29d5 (patch)
tree5d70681ddd31ad0cb69ad7900a9956aaae8aba51 /tools/binman/elf_test.py
parent61e887fb9cbb6e1d64c2383a865f79ed3570bcf8 (diff)
parentcd15b640b0b8d5a7ba5f1c0587e4f9c767e2d8fb (diff)
Merge tag 'dm-pull-20aug22' of https://source.denx.de/u-boot/custodians/u-boot-dm
binman fixes for various things binman clean-up of compression and addition of utilities
Diffstat (limited to 'tools/binman/elf_test.py')
-rw-r--r--tools/binman/elf_test.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index 5a51c64cfe..75b867c2be 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -122,6 +122,8 @@ class TestElf(unittest.TestCase):
def testOutsideFile(self):
"""Test a symbol which extends outside the entry area is detected"""
+ if not elf.ELF_TOOLS:
+ self.skipTest('Python elftools not available')
entry = FakeEntry(10)
section = FakeSection()
elf_fname = self.ElfTestFile('u_boot_binman_syms')
@@ -147,6 +149,8 @@ class TestElf(unittest.TestCase):
Only 32 and 64 bits are supported, since we need to store an offset
into the image.
"""
+ if not elf.ELF_TOOLS:
+ self.skipTest('Python elftools not available')
entry = FakeEntry(10)
section = FakeSection()
elf_fname =self.ElfTestFile('u_boot_binman_syms_size')
@@ -161,6 +165,8 @@ class TestElf(unittest.TestCase):
This should produce -1 values for all thress symbols, taking up the
first 16 bytes of the image.
"""
+ if not elf.ELF_TOOLS:
+ self.skipTest('Python elftools not available')
entry = FakeEntry(28)
section = FakeSection(sym_value=None)
elf_fname = self.ElfTestFile('u_boot_binman_syms')
@@ -172,6 +178,8 @@ class TestElf(unittest.TestCase):
def testDebug(self):
"""Check that enabling debug in the elf module produced debug output"""
+ if not elf.ELF_TOOLS:
+ self.skipTest('Python elftools not available')
try:
tout.init(tout.DEBUG)
entry = FakeEntry(24)
@@ -281,6 +289,8 @@ class TestElf(unittest.TestCase):
def test_read_segments_bad_data(self):
"""Test for read_loadable_segments() with an invalid ELF file"""
+ if not elf.ELF_TOOLS:
+ self.skipTest('Python elftools not available')
fname = self.ElfTestFile('embed_data')
with self.assertRaises(ValueError) as e:
elf.read_loadable_segments(tools.get_bytes(100, 100))
@@ -288,6 +298,8 @@ class TestElf(unittest.TestCase):
def test_get_file_offset(self):
"""Test GetFileOffset() gives the correct file offset for a symbol"""
+ if not elf.ELF_TOOLS:
+ self.skipTest('Python elftools not available')
fname = self.ElfTestFile('embed_data')
syms = elf.GetSymbols(fname, ['embed'])
addr = syms['embed'].address
@@ -314,6 +326,8 @@ class TestElf(unittest.TestCase):
def test_get_symbol_from_address(self):
"""Test GetSymbolFromAddress()"""
+ if not elf.ELF_TOOLS:
+ self.skipTest('Python elftools not available')
fname = self.ElfTestFile('elf_sections')
sym_name = 'calculate'
syms = elf.GetSymbols(fname, [sym_name])