u-boot/test/py/tests/test_semihosting/test_hostfs.py
Simon Glass 752c376987 test/py: Shorten u_boot_console
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/
2025-03-15 10:38:38 +00:00

33 lines
910 B
Python

# SPDX-License-Identifier: GPL-2.0+
""" Unit test for semihosting
"""
import pytest
@pytest.mark.buildconfigspec('semihosting')
def test_semihosting_hostfs(ubman, semihosting_data):
""" Unit test for semihosting
Args:
ubman -- U-Boot console
semihosting_data -- Path to the disk image used for testing.
"""
response = ubman.run_command(
f'load hostfs - $loadaddr {semihosting_data}')
assert '11 bytes read' in response
response = ubman.run_command(
'crc32 $loadaddr $filesize')
assert '==> 60cfccfc' in response
ubman.run_command(
f'save hostfs - $loadaddr {semihosting_data} 11 11')
response = ubman.run_command(
f'load hostfs - $loadaddr {semihosting_data} 4 13')
assert '4 bytes read' in response
response = ubman.run_command(
'crc32 $loadaddr $filesize')
assert '==> e29063ea' in response