summaryrefslogtreecommitdiff
path: root/test/py/tests/test_of_migrate.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/py/tests/test_of_migrate.py')
-rw-r--r--test/py/tests/test_of_migrate.py43
1 files changed, 20 insertions, 23 deletions
diff --git a/test/py/tests/test_of_migrate.py b/test/py/tests/test_of_migrate.py
index 910f7c05510..ab89332331e 100644
--- a/test/py/tests/test_of_migrate.py
+++ b/test/py/tests/test_of_migrate.py
@@ -7,18 +7,18 @@
import os
import pytest
-import u_boot_utils as util
+import utils
# This is needed for Azure, since the default '..' directory is not writeable
TMPDIR1 = '/tmp/test_no_migrate'
TMPDIR2 = '/tmp/test_no_migrate_spl'
TMPDIR3 = '/tmp/test_migrate'
-def build_for_migrate(cons, replace_pair, board, tmpdir, disable_migrate=True):
+def build_for_migrate(ubman, replace_pair, board, tmpdir, disable_migrate=True):
"""Build an updated U-Boot with a slightly modified device tree
Args:
- cons (ConsoleBase): U-Boot console
+ ubman (ConsoleBase): U-Boot console
replace_pair (tuple):
String to find
String to replace it with
@@ -26,15 +26,15 @@ def build_for_migrate(cons, replace_pair, board, tmpdir, disable_migrate=True):
tmpdir (str): Temporary directory to use
disable_migrate (bool): True to disable CONFIG_OF_TAG_MIGRATE in build
"""
- srcdir = cons.config.source_dir
- build_dir = cons.config.build_dir
+ srcdir = ubman.config.source_dir
+ build_dir = ubman.config.build_dir
# Get the source for the existing dts
dt_dir = os.path.join(build_dir, 'arch', 'sandbox', 'dts')
orig_fname = os.path.join(dt_dir, 'sandbox.dtb')
out_dts = os.path.join(dt_dir, 'sandbox_out.dts')
- util.run_and_log(cons, ['dtc', orig_fname, '-I', 'dtb', '-O', 'dts',
- '-o', out_dts])
+ utils.run_and_log(ubman, ['dtc', orig_fname, '-I', 'dtb', '-O', 'dts',
+ '-o', out_dts])
# Update it to use an old tag
with open(out_dts) as inf:
@@ -45,7 +45,7 @@ def build_for_migrate(cons, replace_pair, board, tmpdir, disable_migrate=True):
with open(dts_fname, 'w') as outf:
print(data, file=outf)
dtb_fname = os.path.join(dt_dir, 'sandbox_oldtag.dtb')
- util.run_and_log(cons, ['dtc', dts_fname, '-o', dtb_fname])
+ utils.run_and_log(ubman, ['dtc', dts_fname, '-o', dtb_fname])
migrate = ['-a', '~CONFIG_OF_TAG_MIGRATE'] if disable_migrate else []
@@ -54,24 +54,23 @@ def build_for_migrate(cons, replace_pair, board, tmpdir, disable_migrate=True):
env['EXT_DTB'] = dtb_fname
env['DEVICE_TREE'] = 'sandbox_new'
env['NO_LTO'] = '1' # Speed up build
- out = util.run_and_log(
- cons, ['./tools/buildman/buildman', '-m', '--board', board,
+ out = utils.run_and_log(
+ ubman, ['./tools/buildman/buildman', '-m', '--board', board,
*migrate, '-w', '-o', tmpdir], ignore_errors=True, env=env)
return out
@pytest.mark.slow
@pytest.mark.boardspec('sandbox')
-def test_of_no_migrate(u_boot_console):
+def test_of_no_migrate(ubman):
"""Test sandbox with old boot phase tags like u-boot,dm-pre-proper"""
- cons = u_boot_console
- build_for_migrate(cons, ['bootph-some-ram', 'u-boot,dm-pre-proper'],
+ build_for_migrate(ubman, ['bootph-some-ram', 'u-boot,dm-pre-proper'],
'sandbox', TMPDIR1)
# It should fail to run, since the lcd device will not be bound before
# relocation. so won't get its frame-buffer memory
- out = util.run_and_log(
- cons, [os.path.join(TMPDIR1, 'u-boot'), '-D', '-c', 'help'],
+ out = utils.run_and_log(
+ ubman, [os.path.join(TMPDIR1, 'u-boot'), '-D', '-c', 'help'],
ignore_errors=True)
assert "Video device 'lcd' cannot allocate frame buffer memory" in out
@@ -80,11 +79,10 @@ def test_of_no_migrate(u_boot_console):
@pytest.mark.boardspec('sandbox_spl')
@pytest.mark.boardspec('spl_of_platdata_inst')
@pytest.mark.boardspec('!sandbox_tpl')
-def test_of_no_migrate_spl(u_boot_console):
+def test_of_no_migrate_spl(ubman):
"""Test sandbox with old boot phase tags like u-boot,dm-spl"""
- cons = u_boot_console
- out = build_for_migrate(cons, ['bootph-pre-ram', 'u-boot,dm-spl'],
+ out = build_for_migrate(ubman, ['bootph-pre-ram', 'u-boot,dm-spl'],
'sandbox_spl', TMPDIR2)
# It should fail to build, since the SPL DT will not include 'spl-test'
@@ -94,15 +92,14 @@ def test_of_no_migrate_spl(u_boot_console):
@pytest.mark.slow
@pytest.mark.boardspec('sandbox')
-def test_of_migrate(u_boot_console):
+def test_of_migrate(ubman):
"""Test sandbox shows a message when tags were migrated"""
- cons = u_boot_console
- build_for_migrate(cons, ['bootph-some-ram', 'u-boot,dm-pre-proper'],
+ build_for_migrate(ubman, ['bootph-some-ram', 'u-boot,dm-pre-proper'],
'sandbox', TMPDIR3, disable_migrate=False)
# It should show a migration message
- out = util.run_and_log(
- cons, [os.path.join(TMPDIR3, 'u-boot'), '-D', '-c', 'help'],
+ out = utils.run_and_log(
+ ubman, [os.path.join(TMPDIR3, 'u-boot'), '-D', '-c', 'help'],
ignore_errors=True)
assert "Warning: Device tree includes old 'u-boot,dm-' tags" in out