eadd9dd6135d058fd9759155309d3ac15cad511e
[platform/kernel/u-boot.git] / test / py / tests / test_button.py
1 # SPDX-License-Identifier: GPL-2.0+
2
3 import pytest
4
5 @pytest.mark.boardspec('sandbox')
6 @pytest.mark.buildconfigspec('cmd_button')
7 def test_button_exit_statuses(u_boot_console):
8     """Test that non-input button commands correctly return the command
9     success/failure status."""
10
11     expected_response = 'rc:0'
12     response = u_boot_console.run_command('button list; echo rc:$?')
13     assert(expected_response in response)
14     response = u_boot_console.run_command('button button1; echo rc:$?')
15     assert(expected_response in response)
16
17     expected_response = 'rc:1'
18     response = u_boot_console.run_command('button nonexistent-button; echo rc:$?')
19     assert(expected_response in response)