Philippe Reynes | 1ee2648 | 2020-07-24 18:19:51 +0200 | [diff] [blame] | 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) |
Heinrich Schuchardt | 57c2fc6 | 2020-09-14 12:50:54 +0200 | [diff] [blame^] | 14 | response = u_boot_console.run_command('button button1; echo rc:$?') |
Philippe Reynes | 1ee2648 | 2020-07-24 18:19:51 +0200 | [diff] [blame] | 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) |