@@ -236,9 +236,10 @@ protocol, or any graphical wrapper around gdb.
Some tests deliberately cause the sandbox process to exit, e.g. to test the
reset command, or sandbox's CTRL-C handling. When this happens, you will need
-to attach the debugger to the new sandbox instance. If these tests are not
-relevant to your debugging session, you can skip them using pytest's ``-k``
-command-line option; see the next section.
+to attach the debugger to the new sandbox instance. These tests are marked
+with the ``restart`` pytest marker, so you can skip them all with::
+
+ test/py/test.py -B sandbox --gdbserver localhost:1234 -m "not restart"
Command-line options
--------------------
@@ -606,3 +607,16 @@ set), since the locally launched QEMU is not available in that environment:
.. code-block:: python
@pytest.mark.localqemu
+
+The restart marker indicates that a test restarts the U-Boot process
+during execution, e.g. via ``ubman.restart_uboot()`` or
+``ubman.restart_uboot_with_flags()``. This can be used to skip these tests
+when a restart is not desirable:
+
+.. code-block:: python
+
+ @pytest.mark.restart
+
+To exclude these tests from a test run::
+
+ test/py/test.py -B sandbox -m "not restart"
@@ -15,3 +15,4 @@ markers =
singlethread: Cannot run in parallel
role: U-Boot: Indicates the lab 'role' which can execute this test
localqemu: U-Boot: Test launches its own QEMU, skip in lab mode
+ restart: U-Boot: Test restarts U-Boot during execution
@@ -10,6 +10,7 @@ CONSOLE = 'earlycon=uart8250,io,0x3f8 console=uart8250,io,0x3f8'
@pytest.mark.boardspec('qemu-x86_64')
@pytest.mark.role('qemu-x86_64')
+@pytest.mark.restart
def test_distro(ubman):
"""Test booting into Ubuntu 24.04"""
with ubman.log.section('boot'):
@@ -64,6 +65,7 @@ def test_distro(ubman):
@pytest.mark.boardspec('colibri-imx8x')
@pytest.mark.role('colibrimx8')
+@pytest.mark.restart
def test_distro_script(ubman):
"""Test that a selected board can boot into Llinux using a script"""
with ubman.log.section('boot'):
@@ -79,6 +81,7 @@ def test_distro_script(ubman):
@pytest.mark.boardspec('efi-arm_app64')
@pytest.mark.role('efi-aarch64')
+@pytest.mark.restart
def test_distro_arm_app_extlinux(ubman):
"""Test that the ARM EFI app can boot into Ubuntu 25.04 via extlinux"""
with ubman.log.section('boot'):
@@ -98,6 +101,7 @@ def test_distro_arm_app_extlinux(ubman):
@pytest.mark.boardspec('efi-arm_app64')
@pytest.mark.role('efi-aarch64')
+@pytest.mark.restart
def test_distro_arm_app_efi(ubman):
"""Test that the ARM EFI app can boot into Ubuntu 25.04 via EFI"""
with ubman.log.section('boot'):
@@ -28,6 +28,7 @@ from capsule_common import (
@pytest.mark.buildconfigspec('cmd_nvedit_efi')
@pytest.mark.buildconfigspec('cmd_sf')
@pytest.mark.slow
+@pytest.mark.restart
class TestEfiCapsuleFirmwareFit():
"""Test capsule-on-disk firmware update for FIT images
"""
@@ -29,6 +29,7 @@ from capsule_common import (
@pytest.mark.buildconfigspec('cmd_nvedit_efi')
@pytest.mark.buildconfigspec('cmd_sf')
@pytest.mark.slow
+@pytest.mark.restart
class TestEfiCapsuleFirmwareRaw:
""" Tests verifying capsule-on-disk firmware update for raw images
"""
@@ -31,6 +31,7 @@ from capsule_common import (
@pytest.mark.buildconfigspec('cmd_nvedit_efi')
@pytest.mark.buildconfigspec('cmd_sf')
@pytest.mark.slow
+@pytest.mark.restart
class TestEfiCapsuleFirmwareSignedFit():
"""Capsule-on-disk firmware update test
"""
@@ -29,6 +29,7 @@ from capsule_common import (
@pytest.mark.buildconfigspec('cmd_nvedit_efi')
@pytest.mark.buildconfigspec('cmd_sf')
@pytest.mark.slow
+@pytest.mark.restart
class TestEfiCapsuleFirmwareSignedRaw():
"""Firmware Update (Signed capsule with raw images) Test
"""
@@ -159,6 +159,7 @@ FDT_DATA = '''
@pytest.mark.buildconfigspec('fit')
@pytest.mark.notbuildconfigspec('generate_acpi_table')
@pytest.mark.requiredtool('dtc')
+@pytest.mark.restart
def test_efi_fit_launch(ubman):
"""Test handling of UEFI binaries inside FIT images.
@@ -16,6 +16,7 @@ import pytest
@pytest.mark.buildconfigspec('cmd_fat')
@pytest.mark.buildconfigspec('cmd_nvedit_efi')
@pytest.mark.slow
+@pytest.mark.restart
class TestEfiAuthVar(object):
def test_efi_var_auth1(self, ubman, efi_boot_env):
"""
@@ -17,6 +17,7 @@ import pytest
@pytest.mark.buildconfigspec('cmd_fat')
@pytest.mark.buildconfigspec('cmd_nvedit_efi')
@pytest.mark.slow
+@pytest.mark.restart
class TestEfiSignedImage(object):
def test_efi_signed_image_auth1(self, ubman, efi_boot_env):
"""
@@ -19,6 +19,7 @@ import pytest
@pytest.mark.buildconfigspec('cmd_fat')
@pytest.mark.buildconfigspec('cmd_nvedit_efi')
@pytest.mark.slow
+@pytest.mark.restart
class TestEfiSignedImageIntca(object):
def test_efi_signed_image_intca1(self, ubman, efi_boot_env_intca):
"""
@@ -17,6 +17,7 @@ import pytest
@pytest.mark.buildconfigspec('cmd_fat')
@pytest.mark.buildconfigspec('cmd_nvedit_efi')
@pytest.mark.slow
+@pytest.mark.restart
class TestEfiUnsignedImage(object):
def test_efi_unsigned_image_auth1(self, ubman, efi_boot_env):
"""
@@ -7,6 +7,7 @@
import pytest
@pytest.mark.buildconfigspec('cmd_bootefi_selftest')
+@pytest.mark.restart
def test_efi_selftest_base(ubman):
"""Run UEFI unit tests
@@ -24,6 +25,7 @@ def test_efi_selftest_base(ubman):
@pytest.mark.buildconfigspec('hush_parser')
@pytest.mark.buildconfigspec('of_control')
@pytest.mark.notbuildconfigspec('generate_acpi_table')
+@pytest.mark.restart
def test_efi_selftest_device_tree(ubman):
"""Test the device tree support in the UEFI sub-system
@@ -44,6 +46,7 @@ def test_efi_selftest_device_tree(ubman):
ubman.restart_uboot()
@pytest.mark.buildconfigspec('cmd_bootefi_selftest')
+@pytest.mark.restart
def test_efi_selftest_watchdog_reboot(ubman):
"""Test the watchdog timer
@@ -61,6 +64,7 @@ def test_efi_selftest_watchdog_reboot(ubman):
ubman.run_command(cmd='', send_nl=False, wait_for_reboot=True)
@pytest.mark.buildconfigspec('cmd_bootefi_selftest')
+@pytest.mark.restart
def test_efi_selftest_text_input(ubman):
"""Test the EFI_SIMPLE_TEXT_INPUT_PROTOCOL
@@ -116,6 +120,7 @@ def test_efi_selftest_text_input(ubman):
ubman.restart_uboot()
@pytest.mark.buildconfigspec('cmd_bootefi_selftest')
+@pytest.mark.restart
def test_efi_selftest_text_input_ex(ubman):
"""Test the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
@@ -180,6 +185,7 @@ def test_efi_selftest_text_input_ex(ubman):
@pytest.mark.buildconfigspec('cmd_bootefi_selftest')
@pytest.mark.buildconfigspec('efi_tcg2_protocol')
@pytest.mark.notbuildconfigspec('sandbox')
+@pytest.mark.restart
def test_efi_selftest_tcg2(ubman):
"""Test the EFI_TCG2 PROTOCOL
@@ -12,6 +12,7 @@ from tests import fs_helper
@pytest.mark.boardspec('sandbox')
@pytest.mark.buildconfigspec('cmd_eficonfig')
@pytest.mark.buildconfigspec('cmd_bootefi_bootmgr')
+@pytest.mark.restart
def test_efi_eficonfig(ubman):
def prepare_image(u_boot_config):
@@ -97,6 +97,7 @@ expected_usage = 'fpga - loadable FPGA image support'
@pytest.mark.xfail
@pytest.mark.buildconfigspec('cmd_fpga')
+@pytest.mark.restart
def test_fpga_fail(ubman):
# Test non valid fpga subcommand
expected = 'fpga: non existing command'
@@ -189,7 +189,7 @@ def erofs_run_all_tests(ubman):
@pytest.mark.buildconfigspec('fs_erofs')
@pytest.mark.requiredtool('mkfs.erofs')
@pytest.mark.requiredtool('md5sum')
-
+@pytest.mark.restart
def test_erofs(ubman):
"""
Executes the erofs test suite.
@@ -106,6 +106,7 @@ def sqfs_run_all_ls_tests(ubman):
@pytest.mark.buildconfigspec('fs_squashfs')
@pytest.mark.requiredtool('mksquashfs')
@pytest.mark.singlethread
+@pytest.mark.restart
def test_sqfs_ls(ubman):
""" Executes the sqfsls test suite.
@@ -15,6 +15,7 @@ def test_help(ubman):
assert lines.splitlines()[0] == "? - alias for 'help'"
@pytest.mark.boardspec('sandbox')
+@pytest.mark.restart
def test_help_no_devicetree(ubman):
try:
ubman.restart_uboot_with_flags([], use_dtb=False)
@@ -26,6 +27,7 @@ def test_help_no_devicetree(ubman):
ubman.restart_uboot()
@pytest.mark.boardspec('sandbox_vpl')
+@pytest.mark.restart
def test_vpl_help(ubman):
try:
ubman.restart_uboot()
@@ -41,6 +41,7 @@ def test_log_format(ubman):
@pytest.mark.buildconfigspec('debug_uart')
@pytest.mark.boardspec('sandbox')
+@pytest.mark.restart
def test_log_dropped(ubman):
"""Test dropped 'log' message when debug_uart is activated"""
@@ -41,6 +41,7 @@ def setup_reset_env(ubman):
pytest.skip('skipping reset test due to jtag bootmode')
@pytest.mark.buildconfigspec('hush_parser')
+@pytest.mark.restart
def test_reset(ubman):
"""Test the reset command in non-JTAG bootmode.
It does COLD reset, which resets CPU, DDR and peripherals
@@ -52,6 +53,7 @@ def test_reset(ubman):
test_000_version.test_version(ubman)
@pytest.mark.buildconfigspec('hush_parser')
+@pytest.mark.restart
def test_reset_w(ubman):
"""Test the reset -w command in non-JTAG bootmode.
It does WARM reset, which resets CPU but keep DDR/peripherals active.
@@ -7,6 +7,7 @@ import signal
@pytest.mark.boardspec('sandbox')
@pytest.mark.buildconfigspec('sysreset_cmd_poweroff')
+@pytest.mark.restart
def test_poweroff(ubman):
"""Test that the "poweroff" command exits sandbox process."""
@@ -14,6 +15,7 @@ def test_poweroff(ubman):
assert(ubman.validate_exited())
@pytest.mark.boardspec('sandbox')
+@pytest.mark.restart
def test_ctrl_c(ubman):
"""Test that sending SIGINT to sandbox causes it to exit."""
@@ -23,6 +25,7 @@ def test_ctrl_c(ubman):
@pytest.mark.boardspec('sandbox')
@pytest.mark.buildconfigspec('cmd_exception')
@pytest.mark.buildconfigspec('sandbox_crash_reset')
+@pytest.mark.restart
def test_exception_reset(ubman):
"""Test that SIGILL causes a reset."""
@@ -38,6 +41,7 @@ def test_exception_reset(ubman):
@pytest.mark.boardspec('sandbox')
@pytest.mark.buildconfigspec('cmd_exception')
@pytest.mark.notbuildconfigspec('sandbox_crash_reset')
+@pytest.mark.restart
def test_exception_exit(ubman):
"""Test that SIGILL causes a reset."""
@@ -73,6 +73,7 @@ def set_env(ubman, var_name, var_value):
@pytest.mark.buildconfigspec('cmd_saveenv')
@pytest.mark.buildconfigspec('hush_parser')
+@pytest.mark.restart
def test_saveenv(ubman):
"""Test the saveenv command in non-JTAG bootmode.
It saves the U-Boot environment in persistent storage.
@@ -15,6 +15,7 @@ def test_ut_spl_init(ubman):
with open(fn, 'wb') as fh:
fh.write(data)
+@pytest.mark.restart
def test_spl(ubman, ut_spl_subtest):
"""Execute a "ut" subtest.
@@ -6,6 +6,7 @@ import signal
@pytest.mark.buildconfigspec('cmd_stackprotector_test')
@pytest.mark.notbuildconfigspec('asan')
+@pytest.mark.restart
def test_stackprotector(ubman):
"""Test that the stackprotector function works."""
@@ -9,6 +9,7 @@ import pytest
import utils
@pytest.mark.boardspec('sandbox_vpl')
+@pytest.mark.restart
def test_upl_handoff(ubman):
"""Test of UPL handoff
@@ -10,6 +10,7 @@ import utils
@pytest.mark.boardspec('sandbox_vpl')
@pytest.mark.requiredtool('dtc')
+@pytest.mark.restart
def test_vbe_vpl(ubman):
#cmd = [ubman.config.build_dir + fname, '-v']
ram = os.path.join(ubman.config.build_dir, 'ram.bin')
@@ -141,6 +141,7 @@ TESTDATA += [pytest.param(*v, marks=pytest.mark.slow) for v in TESTDATA_IN[1:]]
@pytest.mark.requiredtool('fdtget')
@pytest.mark.requiredtool('fdtput')
@pytest.mark.requiredtool('openssl')
+@pytest.mark.restart
@pytest.mark.parametrize("name,sha_algo,padding,sign_options,required,full_test,algo_arg,global_sign",
TESTDATA)
def test_vboot_base(ubman, name, sha_algo, padding, sign_options, required,
@@ -5,6 +5,7 @@
import os.path
import pytest
+@pytest.mark.restart
def test_vpl(ubman, ut_vpl_subtest):
"""Execute a "ut" subtest.