summaryrefslogtreecommitdiff
path: root/tools/binman/elf_test.py
diff options
context:
space:
mode:
authorLukas Funke <lukas.funke@weidmueller.com>2023-07-18 13:53:09 +0200
committerSimon Glass <sjg@chromium.org>2023-08-02 07:51:09 -0600
commit43176ed86d9f120efb3e86084d83a714bf076d29 (patch)
treea26d06fdaf2d4cc5ec1633ab583e594476f1d6a5 /tools/binman/elf_test.py
parent7755b2200777f72dca87dd169138e95f011bbcb9 (diff)
binman: elf: Check for ELF_TOOLS availability and remove extra semicolon
Check if elf tools are available when running DecodeElf(). Also remove superfuous semicolon at line ending. Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org> Revert part of patch to make binman test pass Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/elf_test.py')
-rw-r--r--tools/binman/elf_test.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index cc95b424b33..e3dee79d065 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -255,8 +255,20 @@ class TestElf(unittest.TestCase):
fname = self.ElfTestFile('embed_data')
with self.assertRaises(ValueError) as e:
elf.GetSymbolFileOffset(fname, ['embed_start', 'embed_end'])
- self.assertIn("Python: No module named 'elftools'",
- str(e.exception))
+ with self.assertRaises(ValueError) as e:
+ elf.DecodeElf(tools.read_file(fname), 0xdeadbeef)
+ with self.assertRaises(ValueError) as e:
+ elf.GetFileOffset(fname, 0xdeadbeef)
+ with self.assertRaises(ValueError) as e:
+ elf.GetSymbolFromAddress(fname, 0xdeadbeef)
+ with self.assertRaises(ValueError) as e:
+ entry = FakeEntry(10)
+ section = FakeSection()
+ elf.LookupAndWriteSymbols(fname, entry, section, True)
+
+ self.assertIn(
+ "Section 'section_path': entry 'entry_path': Cannot write symbols to an ELF file without Python elftools",
+ str(e.exception))
finally:
elf.ELF_TOOLS = old_val