blob: 12cb36b7b985c104fa0d96491a47095ed78f0986 [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
Simon Glassddba5202025-02-09 09:07:14 -07007def test_help(ubman):
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 Glassddba5202025-02-09 09:07:14 -070010 lines = ubman.run_command('help')
11 if ubman.config.buildconfig.get('config_cmd_2048', 'n') == 'y':
Simon Glass0cb530b2024-06-23 14:30:31 -060012 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')
Simon Glassddba5202025-02-09 09:07:14 -070017def test_help_no_devicetree(ubman):
Simon Glass9a3adfa2022-04-27 13:47:57 -060018 try:
Simon Glass32701112025-02-09 09:07:17 -070019 ubman.restart_uboot_with_flags([], use_dtb=False)
20 ubman.run_command('help')
21 output = ubman.get_spawn_output().replace('\r', '')
Simon Glass9a3adfa2022-04-27 13:47:57 -060022 assert 'print command description/usage' in output
23 finally:
24 # Restart afterward to get the normal device tree back
Simon Glassddba5202025-02-09 09:07:14 -070025 ubman.restart_uboot()
Simon Glass9a3adfa2022-04-27 13:47:57 -060026
Simon Glasse62205d2022-04-30 00:56:56 -060027@pytest.mark.boardspec('sandbox_vpl')
Simon Glassddba5202025-02-09 09:07:14 -070028def test_vpl_help(ubman):
Simon Glasse62205d2022-04-30 00:56:56 -060029 try:
Simon Glass32701112025-02-09 09:07:17 -070030 ubman.restart_uboot()
31 ubman.run_command('help')
32 output = ubman.get_spawn_output().replace('\r', '')
Simon Glasse62205d2022-04-30 00:56:56 -060033 assert 'print command description/usage' in output
34 finally:
35 # Restart afterward to get the normal device tree back
Simon Glassddba5202025-02-09 09:07:14 -070036 ubman.restart_uboot()