2020-07-24 16:19:51 +00:00
|
|
|
# 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)
|
2020-09-14 10:50:54 +00:00
|
|
|
response = u_boot_console.run_command('button button1; echo rc:$?')
|
2020-07-24 16:19:51 +00:00
|
|
|
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)
|