aboutsummaryrefslogtreecommitdiff
path: root/tools/binman/elf_test.py
diff options
context:
space:
mode:
authorSimon Glass2019-05-14 15:53:47 -0600
committerSimon Glass2019-07-10 16:52:58 -0600
commite6d85ff9f239a338748871b93ed11f066609e869 (patch)
tree5add11f4bc83ae9a6c2b9fe57157cb6031ccd16b /tools/binman/elf_test.py
parent6d1d6418645229d5de2f8c52bf6a9ce6a345c2a1 (diff)
binman: Handle repeated bytes for Python 3
The method of multiplying a character by a number works well for creating a repeated string in Python 2. But in Python 3 we need to use bytes() instead, to avoid unicode problems, since 'bytes' is no-longer just an alias of 'str'. Create a function to handle this detail and call it from the relevant places in binman. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/elf_test.py')
-rw-r--r--tools/binman/elf_test.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index b68530c19ba..3d55cb1946e 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -122,7 +122,7 @@ 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(chr(255) * 16 + 'a' * 4, entry.data)
+ self.assertEqual(tools.GetBytes(255, 16) + 'a' * 4, entry.data)
def testDebug(self):
"""Check that enabling debug in the elf module produced debug output"""