Prepare v2024.10
[platform/kernel/u-boot.git] / test / py / tests / test_help.py
1 # SPDX-License-Identifier: GPL-2.0
2 # Copyright (c) 2015 Stephen Warren
3 # Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
4
5 import pytest
6
7 def test_help(u_boot_console):
8     """Test that the "help" command can be executed."""
9
10     lines = u_boot_console.run_command('help')
11     if u_boot_console.config.buildconfig.get('config_cmd_2048', 'n') == 'y':
12         assert lines.splitlines()[0] == "2048      - The 2048 game"
13     else:
14         assert lines.splitlines()[0] == "?         - alias for 'help'"
15
16 @pytest.mark.boardspec('sandbox')
17 def test_help_no_devicetree(u_boot_console):
18     try:
19         cons = u_boot_console
20         cons.restart_uboot_with_flags([], use_dtb=False)
21         cons.run_command('help')
22         output = cons.get_spawn_output().replace('\r', '')
23         assert 'print command description/usage' in output
24     finally:
25         # Restart afterward to get the normal device tree back
26         u_boot_console.restart_uboot()
27
28 @pytest.mark.boardspec('sandbox_vpl')
29 def test_vpl_help(u_boot_console):
30     try:
31         cons = u_boot_console
32         cons.restart_uboot()
33         cons.run_command('help')
34         output = cons.get_spawn_output().replace('\r', '')
35         assert 'print command description/usage' in output
36     finally:
37         # Restart afterward to get the normal device tree back
38         u_boot_console.restart_uboot()