diff options
author | Tom Rini <trini@konsulko.com> | 2020-03-13 13:21:17 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-03-13 13:21:17 -0400 |
commit | 50be9f0e1ccc0909e65132cff216743a49046f97 (patch) | |
tree | cbb6f9c3031ab81d5b0a775906727df844b0a618 /test | |
parent | db3b1818b7a9711084255713ec14cb886eb79b12 (diff) | |
parent | d21ffa2a2ebc366b8ca644324d76bb2924947373 (diff) |
Merge branch '2020-03-13-master-imports'
- Address the regression with the 'gpio' command
- Fix mcfuart regression
- Other minor fixes
Diffstat (limited to 'test')
-rw-r--r-- | test/py/tests/test_gpio.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/py/tests/test_gpio.py b/test/py/tests/test_gpio.py new file mode 100644 index 0000000000..8c64f686b0 --- /dev/null +++ b/test/py/tests/test_gpio.py @@ -0,0 +1,37 @@ +# SPDX-License-Identifier: GPL-2.0+ + +import pytest + +@pytest.mark.boardspec('sandbox') +@pytest.mark.buildconfigspec('cmd_gpio') +def test_gpio_input(u_boot_console): + """Test that gpio input correctly returns the value of a gpio pin.""" + + response = u_boot_console.run_command('gpio input 0; echo rc:$?') + expected_response = 'rc:0' + assert(expected_response in response) + response = u_boot_console.run_command('gpio toggle 0; gpio input 0; echo rc:$?') + expected_response = 'rc:1' + assert(expected_response in response) + +@pytest.mark.boardspec('sandbox') +@pytest.mark.buildconfigspec('cmd_gpio') +def test_gpio_exit_statuses(u_boot_console): + """Test that non-input gpio commands correctly return the command + success/failure status.""" + + expected_response = 'rc:0' + response = u_boot_console.run_command('gpio clear 0; echo rc:$?') + assert(expected_response in response) + response = u_boot_console.run_command('gpio set 0; echo rc:$?') + assert(expected_response in response) + response = u_boot_console.run_command('gpio toggle 0; echo rc:$?') + assert(expected_response in response) + response = u_boot_console.run_command('gpio status -a; echo rc:$?') + assert(expected_response in response) + + expected_response = 'rc:1' + response = u_boot_console.run_command('gpio nonexistent-command; echo rc:$?') + assert(expected_response in response) + response = u_boot_console.run_command('gpio input 200; echo rc:$?') + assert(expected_response in response) |