dtoc: Use binary mode for reading files

The .dtb files are binary so we should open them as binary files. This
allows Python 3 to use the correct 'bytes' type.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2019-05-17 22:00:39 -06:00
parent 635180538e
commit 2ab6e13e01

View File

@ -85,13 +85,13 @@ class TestFdt(unittest.TestCase):
def testFlush(self):
"""Check that we can flush the device tree out to its file"""
fname = self.dtb._fname
with open(fname) as fd:
with open(fname, 'rb') as fd:
data = fd.read()
os.remove(fname)
with self.assertRaises(IOError):
open(fname)
open(fname, 'rb')
self.dtb.Flush()
with open(fname) as fd:
with open(fname, 'rb') as fd:
data = fd.read()
def testPack(self):