mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-08-16 04:07:00 +02:00
This fixture name is quite long and results in lots of verbose code. We know this is U-Boot so the 'u_boot_' part is not necessary. But it is also a bit of a misnomer, since it provides access to all the information available to tests. It is not just the console. It would be too confusing to use con as it would be confused with config and it is probably too short. So shorten it to 'ubman'. Signed-off-by: Simon Glass <sjg@chromium.org> Link: https://lore.kernel.org/u-boot/CAFLszTgPa4aT_J9h9pqeTtLCVn4x2JvLWRcWRD8NaN3uoSAtyA@mail.gmail.com/
56 lines
1.7 KiB
Python
56 lines
1.7 KiB
Python
# SPDX-License-Identifier: GPL-2.0+
|
|
# Copyright (c) 2020
|
|
# Author: Kory Maincent <kory.maincent@bootlin.com>
|
|
|
|
# Test U-Boot's "extension" commands.
|
|
|
|
import os
|
|
import pytest
|
|
import u_boot_utils
|
|
|
|
overlay_addr = 0x1000
|
|
|
|
SANDBOX_DTB='arch/sandbox/dts/sandbox.dtb'
|
|
OVERLAY_DIR='arch/sandbox/dts/'
|
|
|
|
def load_dtb(ubman):
|
|
ubman.log.action('Loading devicetree to RAM...')
|
|
ubman.run_command('host load hostfs - $fdt_addr_r %s' % (os.path.join(ubman.config.build_dir, SANDBOX_DTB)))
|
|
ubman.run_command('fdt addr $fdt_addr_r')
|
|
|
|
@pytest.mark.buildconfigspec('cmd_fdt')
|
|
@pytest.mark.boardspec('sandbox')
|
|
def test_extension(ubman):
|
|
"""Test the 'extension' command."""
|
|
|
|
load_dtb(ubman)
|
|
|
|
output = ubman.run_command('extension list')
|
|
# extension_bootdev_hunt may have already run.
|
|
# Without reboot we cannot make any assumption here.
|
|
# assert('No extension' in output)
|
|
|
|
output = ubman.run_command('extension scan')
|
|
assert output == 'Found 2 extension board(s).'
|
|
|
|
output = ubman.run_command('extension list')
|
|
assert('overlay0.dtbo' in output)
|
|
assert('overlay1.dtbo' in output)
|
|
|
|
ubman.run_command_list([
|
|
'setenv extension_overlay_addr %s' % (overlay_addr),
|
|
'setenv extension_overlay_cmd \'host load hostfs - ${extension_overlay_addr} %s${extension_overlay_name}\'' % (os.path.join(ubman.config.build_dir, OVERLAY_DIR))])
|
|
|
|
output = ubman.run_command('extension apply 0')
|
|
assert('bytes read' in output)
|
|
|
|
output = ubman.run_command('fdt print')
|
|
assert('button3' in output)
|
|
|
|
output = ubman.run_command('extension apply all')
|
|
assert('bytes read' in output)
|
|
|
|
output = ubman.run_command('fdt print')
|
|
assert('button4' in output)
|
|
|