Files
u-boot/test/py/tests/test_upl.py
Simon Glass aa1ada905b test: py: Add run_ut() helper for manual unit tests
Running manual unit tests (those with _norun suffix) involves a common
pattern: building the ut command with the -f flag, running it, and
checking for failures. This is verbose and error-prone.

Add a run_ut() method to ConsoleBase that simplifies this. It handles
the command construction, test arguments and failure checking
automatically.

Before:
    output = ubman.run_command(
        f'ut -f fs fs_test_ext4l_probe_norun fs_image={ext4_image}')
    assert 'failures: 0' in output

After:
    ubman.run_ut('fs', 'fs_test_ext4l_probe', fs_image=ext4_image)

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-29 16:18:51 +00:00

37 lines
1.2 KiB
Python

# SPDX-License-Identifier: GPL-2.0+
# Copyright 2024 Google LLC
#
# Test addition of Universal Payload
import os
import pytest
import utils
@pytest.mark.boardspec('sandbox_vpl')
def test_upl_handoff(ubman):
"""Test of UPL handoff
This works by starting up U-Boot VPL, which gets to SPL and then sets up a
UPL handoff using the FIT containing U-Boot proper. It then jumps to U-Boot
proper and runs a test to check that the parameters are correct.
The entire FIT is loaded into memory in SPL (in upl_load_from_image()) so
that it can be inspected in upl_test_info_norun
"""
ram = os.path.join(ubman.config.build_dir, 'ram.bin')
fdt = os.path.join(ubman.config.build_dir, 'u-boot.dtb')
# Remove any existing RAM file, so we don't have old data present
if os.path.exists(ram):
os.remove(ram)
flags = ['-m', ram, '-d', fdt, '--upl']
ubman.restart_uboot_with_flags(flags, use_dtb=False)
# Make sure that Universal Payload is detected in U-Boot proper
output = ubman.run_command('upl info')
assert 'UPL state: active' == output
# Check the FIT offsets look correct
ubman.run_ut('upl', 'upl_test_info')