summaryrefslogtreecommitdiff
path: root/test/py/tests/test_button.py
blob: 98067a98f2896c8c7a0ae97fbda186ccce015c72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 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)
    response = u_boot_console.run_command('button summer; echo rc:$?')
    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)