]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
test: Check help output
authorSimon Glass <sjg@chromium.org>
Sun, 23 Jun 2024 20:30:31 +0000 (14:30 -0600)
committerTom Rini <trini@konsulko.com>
Thu, 4 Jul 2024 15:25:21 +0000 (09:25 -0600)
The current test doesn't check anything about the output. If a bug
results in junk before the output, this is not currently detected.

Add a check for the first line being the one expected.

Signed-off-by: Simon Glass <sjg@chromium.org>
test/py/tests/test_help.py

index 153133cf28f881120e7d24f3d724ee49d16a1ec9..2325ff6922936cd5ececc22caafa640e47992f75 100644 (file)
@@ -7,7 +7,11 @@ import pytest
 def test_help(u_boot_console):
     """Test that the "help" command can be executed."""
 
-    u_boot_console.run_command('help')
+    lines = u_boot_console.run_command('help')
+    if u_boot_console.config.buildconfig.get('config_cmd_2048', 'n') == 'y':
+        assert lines.splitlines()[0] == "2048      - The 2048 game"
+    else:
+        assert lines.splitlines()[0] == "?         - alias for 'help'"
 
 @pytest.mark.boardspec('sandbox')
 def test_help_no_devicetree(u_boot_console):