Files
u-boot/test/py/tests/test_cat.py
Simon Glass e9f9e8123e test: Convert test_cat to use FsHelper
Simplify this test by using the helper.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-29 07:06:45 +12:00

25 lines
677 B
Python

# SPDX-License-Identifier: GPL-2.0+
""" Unit test for cat command
"""
import pytest
from tests.fs_helper import FsHelper
@pytest.mark.boardspec('sandbox')
@pytest.mark.buildconfigspec('cmd_cat')
def test_cat(ubman):
""" Unit test for cat
Args:
ubman -- U-Boot console
"""
with FsHelper(ubman.config, 'vfat', 1, 'test_cat') as fsh:
with open(f'{fsh.srcdir}/hello', 'w', encoding = 'ascii') as outf:
outf.write('hello world\n')
fsh.mk_fs()
response = ubman.run_command_list([f'host bind 0 {fsh.fs_img}',
'cat host 0 hello'])
assert 'hello world' in response