X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=test%2Fpy%2Ftests%2Ftest_fit.py;h=34696e976796baf22269e66cbac55833b422212b;hb=1703fbefd9183fffd76f4744a73f5ca9daef6313;hp=7e6b96dae45a5665d2a50f3f9524093156642e0a;hpb=c1b62ba9ca0e41fdd548cb3bb9af3b3f90d4a393;p=u-boot diff --git a/test/py/tests/test_fit.py b/test/py/tests/test_fit.py index 7e6b96dae4..34696e9767 100755 --- a/test/py/tests/test_fit.py +++ b/test/py/tests/test_fit.py @@ -1,9 +1,10 @@ -# Copyright (c) 2013, Google Inc. -# # SPDX-License-Identifier: GPL-2.0+ +# Copyright (c) 2013, Google Inc. # # Sanity check of the FIT handling in U-Boot +from __future__ import print_function + import os import pytest import struct @@ -111,6 +112,7 @@ sb save hostfs 0 %(loadables2_addr)x %(loadables2_out)s %(loadables2_size)x @pytest.mark.boardspec('sandbox') @pytest.mark.buildconfigspec('fit_signature') +@pytest.mark.requiredtool('dtc') def test_fit(u_boot_console): def make_fname(leaf): """Make a temporary filename @@ -141,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(): @@ -153,7 +155,7 @@ def test_fit(u_boot_console): src = make_fname('u-boot.dts') dtb = make_fname('u-boot.dtb') with open(src, 'w') as fd: - print >> fd, base_fdt + print(base_fdt, file=fd) util.run_and_log(cons, ['dtc', src, '-O', 'dtb', '-o', dtb]) return dtb @@ -167,7 +169,7 @@ def test_fit(u_boot_console): """ its = make_fname('test.its') with open(its, 'w') as fd: - print >> fd, base_its % params + print(base_its % params, file=fd) return its def make_fit(mkimage, params): @@ -186,7 +188,7 @@ def test_fit(u_boot_console): its = make_its(params) util.run_and_log(cons, [mkimage, '-f', its, fit]) with open(make_fname('u-boot.dts'), 'w') as fd: - print >> fd, base_fdt + print(base_fdt, file=fd) return fit def make_kernel(filename, text): @@ -202,7 +204,7 @@ def test_fit(u_boot_console): for i in range(100): data += 'this %s %d is unlikely to boot\n' % (text, i) with open(fname, 'w') as fd: - print >> fd, data + print(data, file=fd) return fname def make_ramdisk(filename, text): @@ -216,7 +218,7 @@ def test_fit(u_boot_console): for i in range(100): data += '%s %d was seldom used in the middle ages\n' % (text, i) with open(fname, 'w') as fd: - print >> fd, data + print(data, file=fd) return fname def find_matching(text, match):