Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
Stephen Warren | 10e5063 | 2016-01-15 11:15:24 -0700 | [diff] [blame] | 2 | # Copyright (c) 2015 Stephen Warren |
| 3 | # Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. |
Stephen Warren | 10e5063 | 2016-01-15 11:15:24 -0700 | [diff] [blame] | 4 | |
Simon Glass | e62205d | 2022-04-30 00:56:56 -0600 | [diff] [blame] | 5 | import pytest |
| 6 | |
Stephen Warren | 10e5063 | 2016-01-15 11:15:24 -0700 | [diff] [blame] | 7 | def test_help(u_boot_console): |
Stephen Warren | 75e731e | 2016-01-26 13:41:30 -0700 | [diff] [blame] | 8 | """Test that the "help" command can be executed.""" |
Stephen Warren | 10e5063 | 2016-01-15 11:15:24 -0700 | [diff] [blame] | 9 | |
Simon Glass | 0cb530b | 2024-06-23 14:30:31 -0600 | [diff] [blame] | 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'" |
Simon Glass | e62205d | 2022-04-30 00:56:56 -0600 | [diff] [blame] | 15 | |
Simon Glass | 9a3adfa | 2022-04-27 13:47:57 -0600 | [diff] [blame] | 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 | |
Simon Glass | e62205d | 2022-04-30 00:56:56 -0600 | [diff] [blame] | 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() |