test_button.py 692 B

12345678910111213141516171819
  1. # SPDX-License-Identifier: GPL-2.0+
  2. import pytest
  3. @pytest.mark.boardspec('sandbox')
  4. @pytest.mark.buildconfigspec('cmd_button')
  5. def test_button_exit_statuses(u_boot_console):
  6. """Test that non-input button commands correctly return the command
  7. success/failure status."""
  8. expected_response = 'rc:0'
  9. response = u_boot_console.run_command('button list; echo rc:$?')
  10. assert(expected_response in response)
  11. response = u_boot_console.run_command('button summer; echo rc:$?')
  12. assert(expected_response in response)
  13. expected_response = 'rc:1'
  14. response = u_boot_console.run_command('button nonexistent-button; echo rc:$?')
  15. assert(expected_response in response)