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')
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')
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')
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)
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))
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
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])
def testUpdateFdtInElf(self):
"""Test that we can update the devicetree in an ELF file"""
+ if not elf.ELF_TOOLS:
+ self.skipTest('Python elftools not available')
infile = elf_fname = self.ElfTestFile('u_boot_binman_embed')
outfile = os.path.join(self._indir, 'u-boot.out')
begin_sym = 'dtb_embed_begin'
def testUpdateFdtInElfNoSyms(self):
"""Test that missing symbols are detected with --update-fdt-in-elf"""
+ if not elf.ELF_TOOLS:
+ self.skipTest('Python elftools not available')
infile = elf_fname = self.ElfTestFile('u_boot_binman_embed')
outfile = ''
begin_sym = 'wrong_begin'
def testUpdateFdtInElfTooSmall(self):
"""Test that an over-large dtb is detected with --update-fdt-in-elf"""
+ if not elf.ELF_TOOLS:
+ self.skipTest('Python elftools not available')
infile = elf_fname = self.ElfTestFile('u_boot_binman_embed_sm')
outfile = os.path.join(self._indir, 'u-boot.out')
begin_sym = 'dtb_embed_begin'
def testFitSplitElf(self):
"""Test an image with an FIT with an split-elf operation"""
+ if not elf.ELF_TOOLS:
+ self.skipTest('Python elftools not available')
entry_args = {
'of-list': 'test-fdt1 test-fdt2',
'default-dt': 'test-fdt2',
def testFitSplitElfBadElf(self):
"""Test a FIT split-elf operation with an invalid ELF file"""
+ if not elf.ELF_TOOLS:
+ self.skipTest('Python elftools not available')
TestFunctional._MakeInputFile('bad.elf', tools.get_bytes(100, 100))
entry_args = {
'of-list': 'test-fdt1 test-fdt2',
def testFitSplitElfBadDirective(self):
"""Test a FIT split-elf invalid fit,xxx directive in an image node"""
+ if not elf.ELF_TOOLS:
+ self.skipTest('Python elftools not available')
err = self._check_bad_fit('227_fit_bad_dir.dts')
self.assertIn(
"Node '/binman/fit': subnode 'images/@atf-SEQ': Unknown directive 'fit,something'",
def testFitSplitElfBadDirectiveConfig(self):
"""Test a FIT split-elf with invalid fit,xxx directive in config"""
+ if not elf.ELF_TOOLS:
+ self.skipTest('Python elftools not available')
err = self._check_bad_fit('228_fit_bad_dir_config.dts')
self.assertEqual(
"Node '/binman/fit': subnode 'configurations/@config-SEQ': Unknown directive 'fit,config'",
def testFitSplitElfMissing(self):
"""Test an split-elf FIT with a missing ELF file"""
+ if not elf.ELF_TOOLS:
+ self.skipTest('Python elftools not available')
out, err = self.checkFitSplitElf(allow_missing=True)
self.assertRegex(
err,
def testFitSplitElfFaked(self):
"""Test an split-elf FIT with faked ELF file"""
+ if not elf.ELF_TOOLS:
+ self.skipTest('Python elftools not available')
out, err = self.checkFitSplitElf(allow_missing=True, allow_fake_blobs=True)
self.assertRegex(
err,