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 | |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame^] | 7 | def test_help(ubman): |
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 | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame^] | 10 | lines = ubman.run_command('help') |
| 11 | if ubman.config.buildconfig.get('config_cmd_2048', 'n') == 'y': |
Simon Glass | 0cb530b | 2024-06-23 14:30:31 -0600 | [diff] [blame] | 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') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame^] | 17 | def test_help_no_devicetree(ubman): |
Simon Glass | 9a3adfa | 2022-04-27 13:47:57 -0600 | [diff] [blame] | 18 | try: |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame^] | 19 | cons = ubman |
Simon Glass | 9a3adfa | 2022-04-27 13:47:57 -0600 | [diff] [blame] | 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 |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame^] | 26 | ubman.restart_uboot() |
Simon Glass | 9a3adfa | 2022-04-27 13:47:57 -0600 | [diff] [blame] | 27 | |
Simon Glass | e62205d | 2022-04-30 00:56:56 -0600 | [diff] [blame] | 28 | @pytest.mark.boardspec('sandbox_vpl') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame^] | 29 | def test_vpl_help(ubman): |
Simon Glass | e62205d | 2022-04-30 00:56:56 -0600 | [diff] [blame] | 30 | try: |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame^] | 31 | cons = ubman |
Simon Glass | e62205d | 2022-04-30 00:56:56 -0600 | [diff] [blame] | 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 |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame^] | 38 | ubman.restart_uboot() |