aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPhilippe Reynes <philippe.reynes@softathome.com>2020-07-24 18:19:51 +0200
committerSimon Glass <sjg@chromium.org>2020-07-28 19:30:39 -0600
commita6c6f0f0c8880b2f3d04784eef49f85b78d0f29e (patch)
tree739f911c3f174f9c9d1772b3baa3e208959187a8 /test
parent5f9228691c5522f4a3d44334b46f42fb02333a77 (diff)
downloadu-boot-a6c6f0f0c8880b2f3d04784eef49f85b78d0f29e.zip
u-boot-a6c6f0f0c8880b2f3d04784eef49f85b78d0f29e.tar.gz
u-boot-a6c6f0f0c8880b2f3d04784eef49f85b78d0f29e.tar.bz2
test/py: add tests for the button commands
Adds tests for the button commands. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Diffstat (limited to 'test')
-rw-r--r--test/py/tests/test_button.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/py/tests/test_button.py b/test/py/tests/test_button.py
new file mode 100644
index 0000000..98067a9
--- /dev/null
+++ b/test/py/tests/test_button.py
@@ -0,0 +1,19 @@
+# SPDX-License-Identifier: GPL-2.0+
+
+import pytest
+
+@pytest.mark.boardspec('sandbox')
+@pytest.mark.buildconfigspec('cmd_button')
+def test_button_exit_statuses(u_boot_console):
+ """Test that non-input button commands correctly return the command
+ success/failure status."""
+
+ expected_response = 'rc:0'
+ response = u_boot_console.run_command('button list; echo rc:$?')
+ assert(expected_response in response)
+ response = u_boot_console.run_command('button summer; echo rc:$?')
+ assert(expected_response in response)
+
+ expected_response = 'rc:1'
+ response = u_boot_console.run_command('button nonexistent-button; echo rc:$?')
+ assert(expected_response in response)