1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-02 01:02:19 +02:00

binman: Convert to use bytes type

With Python 3 we want to use the 'bytes' type instead of 'str'. Adjust the
code accordingly so that it works on both Python 2 and Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2019-05-17 22:00:46 -06:00
parent 58632a7f44
commit c6c10e77fb
6 changed files with 77 additions and 72 deletions

View File

@@ -22,7 +22,7 @@ class FakeEntry:
"""
def __init__(self, contents_size):
self.contents_size = contents_size
self.data = 'a' * contents_size
self.data = tools.GetBytes(ord('a'), contents_size)
def GetPath(self):
return 'entry_path'
@@ -122,7 +122,8 @@ class TestElf(unittest.TestCase):
section = FakeSection(sym_value=None)
elf_fname = os.path.join(binman_dir, 'test', 'u_boot_binman_syms')
syms = elf.LookupAndWriteSymbols(elf_fname, entry, section)
self.assertEqual(tools.GetBytes(255, 16) + 'a' * 4, entry.data)
self.assertEqual(tools.GetBytes(255, 16) + tools.GetBytes(ord('a'), 4),
entry.data)
def testDebug(self):
"""Check that enabling debug in the elf module produced debug output"""