summaryrefslogtreecommitdiff
path: root/tools/binman/elf_test.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-05-17 22:00:46 -0600
committerSimon Glass <sjg@chromium.org>2019-07-10 16:52:58 -0600
commitc6c10e77fb48f3e55857e379be86384fbcdc19d5 (patch)
tree96e378365de845827a346236e1415d63a9b064ad /tools/binman/elf_test.py
parent58632a7f44cb0aef2c5cd4ede966c89abc430968 (diff)
downloadu-boot-c6c10e77fb48f3e55857e379be86384fbcdc19d5.tar.gz
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>
Diffstat (limited to 'tools/binman/elf_test.py')
-rw-r--r--tools/binman/elf_test.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index 3d55cb1946..42d94cbbbe 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -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"""