blob: 2325ff6922936cd5ececc22caafa640e47992f75 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001# SPDX-License-Identifier: GPL-2.0
Stephen Warren10e50632016-01-15 11:15:24 -07002# Copyright (c) 2015 Stephen Warren
3# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
Stephen Warren10e50632016-01-15 11:15:24 -07004
Simon Glasse62205d2022-04-30 00:56:56 -06005import pytest
6
Stephen Warren10e50632016-01-15 11:15:24 -07007def test_help(u_boot_console):
Stephen Warren75e731e2016-01-26 13:41:30 -07008 """Test that the "help" command can be executed."""
Stephen Warren10e50632016-01-15 11:15:24 -07009
Simon Glass0cb530b2024-06-23 14:30:31 -060010 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'"
Simon Glasse62205d2022-04-30 00:56:56 -060015
Simon Glass9a3adfa2022-04-27 13:47:57 -060016@pytest.mark.boardspec('sandbox')
17def 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
Simon Glasse62205d2022-04-30 00:56:56 -060028@pytest.mark.boardspec('sandbox_vpl')
29def 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()