blob: 98067a98f2896c8c7a0ae97fbda186ccce015c72 [file] [log] [blame]
Philippe Reynes1ee26482020-07-24 18:19:51 +02001# SPDX-License-Identifier: GPL-2.0+
2
3import pytest
4
5@pytest.mark.boardspec('sandbox')
6@pytest.mark.buildconfigspec('cmd_button')
7def 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 summer; 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)