summaryrefslogtreecommitdiff
path: root/test/py/tests
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2018-07-11 09:40:38 -0400
committerTom Rini <trini@konsulko.com>2018-07-11 09:40:38 -0400
commit1703fbefd9183fffd76f4744a73f5ca9daef6313 (patch)
treed1155db77dc38ebb02aa0ee66f4559032c092d74 /test/py/tests
parent421be6fca5cbe0d9dd3a10467529eed53528c258 (diff)
parent8793631ec13ee9e6c7189a7bdca38dde7b4390a8 (diff)
Merge git://git.denx.de/u-boot-dm
Diffstat (limited to 'test/py/tests')
-rwxr-xr-xtest/py/tests/test_fit.py14
-rw-r--r--test/py/tests/test_hush_if_test.py2
-rw-r--r--test/py/tests/test_vboot.py4
3 files changed, 11 insertions, 9 deletions
diff --git a/test/py/tests/test_fit.py b/test/py/tests/test_fit.py
index e407ccc05a..34696e9767 100755
--- a/test/py/tests/test_fit.py
+++ b/test/py/tests/test_fit.py
@@ -3,6 +3,8 @@
#
# Sanity check of the FIT handling in U-Boot
+from __future__ import print_function
+
import os
import pytest
import struct
@@ -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):
diff --git a/test/py/tests/test_hush_if_test.py b/test/py/tests/test_hush_if_test.py
index 1196e0a53f..bba8d41d96 100644
--- a/test/py/tests/test_hush_if_test.py
+++ b/test/py/tests/test_hush_if_test.py
@@ -148,7 +148,7 @@ def test_hush_if_test_host_file_exists(u_boot_console):
exec_hush_if(u_boot_console, expr, False)
try:
- with file(test_file, 'wb'):
+ with open(test_file, 'wb'):
pass
assert os.path.exists(test_file)
diff --git a/test/py/tests/test_vboot.py b/test/py/tests/test_vboot.py
index 3d25ec3d66..e9cbd57fba 100644
--- a/test/py/tests/test_vboot.py
+++ b/test/py/tests/test_vboot.py
@@ -210,8 +210,8 @@ def test_vboot(u_boot_console):
public_exponent = 65537
util.run_and_log(cons, 'openssl genpkey -algorithm RSA -out %sdev.key '
'-pkeyopt rsa_keygen_bits:2048 '
- '-pkeyopt rsa_keygen_pubexp:%d '
- '2>/dev/null' % (tmpdir, public_exponent))
+ '-pkeyopt rsa_keygen_pubexp:%d' %
+ (tmpdir, public_exponent))
# Create a certificate containing the public key
util.run_and_log(cons, 'openssl req -batch -new -x509 -key %sdev.key -out '