blob: eadd9dd6135d058fd9759155309d3ac15cad511e [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)
Heinrich Schuchardt57c2fc62020-09-14 12:50:54 +020014 response = u_boot_console.run_command('button button1; echo rc:$?')
Philippe Reynes1ee26482020-07-24 18:19:51 +020015 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)