summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@imgtec.com>2017-09-14 14:34:48 -0700
committerSimon Glass <sjg@chromium.org>2018-07-10 14:50:50 -0600
commit57bf9bea340690724df9de8ad82bf0d716efaa5b (patch)
tree2d88a1abb1fb93e025b481ddcde240734bffd55b /test
parent052ca37daa20a9825d7ce905d632e349f434058d (diff)
test/py: fit: Open files as binary files
The read_file() function in test_fit is used with files that are not text files, as well as some that are. It is never used in a way that requires it to decode text files to characters, so open all files in binary mode such that read() doesn't attempt to decode characters for files which are not text files. Without this test_fit fails on python 3.x when reading an FDT in run_fit_test() with: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position 0: invalid continuation byte Signed-off-by: Paul Burton <paul.burton@imgtec.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'test')
-rwxr-xr-xtest/py/tests/test_fit.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/py/tests/test_fit.py b/test/py/tests/test_fit.py
index a0f9350411..34696e9767 100755
--- a/test/py/tests/test_fit.py
+++ b/test/py/tests/test_fit.py
@@ -143,7 +143,7 @@ def test_fit(u_boot_console):
Returns:
Contents of file as a string
"""
- with open(fname, 'r') as fd:
+ with open(fname, 'rb') as fd:
return fd.read()
def make_dtb():